This repository has been archived by the owner on Oct 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(youtube/sponsorblock): fix toast shown when scrubbing thru a paus…
…ed video (#401)
- Loading branch information
1 parent
fc2ad5f
commit 7da5673
Showing
6 changed files
with
88 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/src/main/java/app/revanced/integrations/shared/VideoState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package app.revanced.integrations.shared | ||
|
||
import app.revanced.integrations.utils.LogHelper | ||
import app.revanced.integrations.patches.VideoInformation | ||
|
||
/** | ||
* VideoState playback state. | ||
*/ | ||
enum class VideoState { | ||
NEW, | ||
PLAYING, | ||
PAUSED, | ||
RECOVERABLE_ERROR, | ||
UNRECOVERABLE_ERROR, | ||
/** | ||
* @see [VideoInformation.isAtEndOfVideo] | ||
*/ | ||
ENDED; | ||
|
||
companion object { | ||
|
||
private val nameToVideoState = values().associateBy { it.name } | ||
|
||
@JvmStatic | ||
fun setFromString(enumName: String) { | ||
val state = nameToVideoState[enumName] | ||
if (state == null) { | ||
LogHelper.printException { "Unknown VideoState encountered: $enumName" } | ||
} else if (currentVideoState != state) { | ||
LogHelper.printDebug { "VideoState changed to: $state" } | ||
currentVideoState = state | ||
} | ||
} | ||
|
||
/** | ||
* Depending on which hook this is called from, | ||
* this value may not be up to date with the actual playback state. | ||
*/ | ||
@JvmStatic | ||
var current: VideoState? | ||
get() = currentVideoState | ||
private set(value) { | ||
currentVideoState = value | ||
} | ||
|
||
private var currentVideoState : VideoState? = null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters