From 43b3a31119fdb465ca093b6a4fd22dc71dc6554d Mon Sep 17 00:00:00 2001 From: caneleex Date: Fri, 23 Jul 2021 17:44:42 +0200 Subject: [PATCH] reset segments when closing videos --- app/src/main/java/pl/jakubweg/PlayerController.java | 3 ++- app/src/main/java/pl/jakubweg/SponsorBlockUtils.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/pl/jakubweg/PlayerController.java b/app/src/main/java/pl/jakubweg/PlayerController.java index 9dc1a2f..b996415 100644 --- a/app/src/main/java/pl/jakubweg/PlayerController.java +++ b/app/src/main/java/pl/jakubweg/PlayerController.java @@ -56,7 +56,8 @@ public class PlayerController { public static void setCurrentVideoId(final String videoId) { if (videoId == null) { - Log.d(TAG, "setCurrentVideoId: videoId is null"); + currentVideoId = null; + sponsorSegmentsOfCurrentVideo = null; return; } diff --git a/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java b/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java index 1e6f084..fceb5b7 100644 --- a/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java +++ b/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java @@ -616,7 +616,7 @@ public abstract class SponsorBlockUtils { } public static String getTimeWithoutSegments() { - if (!SponsorBlockSettings.isSponsorBlockEnabled || sponsorSegmentsOfCurrentVideo == null) { + if (!SponsorBlockSettings.isSponsorBlockEnabled || !SponsorBlockSettings.showTimeWithoutSegments || sponsorSegmentsOfCurrentVideo == null) { return ""; } long timeWithoutSegments = PlayerController.getCurrentVideoLength(); @@ -631,6 +631,7 @@ public abstract class SponsorBlockUtils { try { if (videoHasSegments && (playerType.equalsIgnoreCase("NONE"))) { needToAppendTime = true; + PlayerController.setCurrentVideoId(null); return; } }