generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(youtube/video-ads): add switch to temporarily fix buffering issues
- Loading branch information
Showing
11 changed files
with
246 additions
and
95 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
13 changes: 13 additions & 0 deletions
13
...kotlin/app/revanced/patches/youtube/misc/playback/annotations/FixPlaybackCompatibility.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,13 @@ | ||
package app.revanced.patches.youtube.misc.playback.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.41.37") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class FixPlaybackCompatibility |
52 changes: 52 additions & 0 deletions
52
src/main/kotlin/app/revanced/patches/youtube/misc/playback/patch/FixPlaybackPatch.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,52 @@ | ||
package app.revanced.patches.youtube.misc.playback.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch | ||
import app.revanced.patches.youtube.misc.playback.annotations.FixPlaybackCompatibility | ||
import app.revanced.patches.youtube.misc.playercontroller.patch.PlayerControllerPatch | ||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference | ||
import app.revanced.patches.youtube.misc.videoid.patch.VideoIdPatch | ||
|
||
@DependsOn([ | ||
IntegrationsPatch::class, | ||
PlayerControllerPatch::class, // updates video length and adds method to seek in video, necessary for this patch | ||
SettingsPatch::class, | ||
VideoIdPatch::class | ||
]) | ||
@Name("fix-playback") | ||
@Description("Fixes the issue with videos not playing when video ads are removed.") | ||
@FixPlaybackCompatibility | ||
@Version("0.0.1") | ||
class FixPlaybackPatch : ResourcePatch { | ||
override fun execute(context: ResourceContext): PatchResult { | ||
SettingsPatch.PreferenceScreen.MISC.addPreferences( | ||
SwitchPreference( | ||
"revanced_fix_playback", | ||
StringResource("revanced_fix_playback_title", "Fix video playback issues"), | ||
false, | ||
StringResource( | ||
"revanced_fix_playback_summary_on", | ||
"The fix is enabled" | ||
), | ||
StringResource( | ||
"revanced_fix_playback_summary_off", | ||
"The fix is disabled" | ||
) | ||
) | ||
) | ||
|
||
// If a new video loads, fix the playback issue | ||
VideoIdPatch.injectCall("Lapp/revanced/integrations/patches/FixPlaybackPatch;->newVideoLoaded(Ljava/lang/String;)V") | ||
|
||
return PatchResultSuccess() | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...evanced/patches/youtube/misc/playercontroller/annotation/PlayerControllerCompatibility.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,13 @@ | ||
package app.revanced.patches.youtube.misc.playercontroller.annotation | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.41.37") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class PlayerControllerCompatibility |
15 changes: 15 additions & 0 deletions
15
.../patches/youtube/misc/playercontroller/fingerprint/CreateVideoPlayerSeekbarFingerprint.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,15 @@ | ||
package app.revanced.patches.youtube.misc.playercontroller.fingerprint | ||
|
||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
|
||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint | ||
import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility | ||
|
||
@Name("create-video-player-seekbar-fingerprint") | ||
@SponsorBlockCompatibility | ||
@Version("0.0.1") | ||
object CreateVideoPlayerSeekbarFingerprint : MethodFingerprint( | ||
"V", | ||
strings = listOf("timed_markers_width") | ||
) |
2 changes: 1 addition & 1 deletion
2
...ode/fingerprints/PlayerInitFingerprint.kt → ...ller/fingerprint/PlayerInitFingerprint.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
2 changes: 1 addition & 1 deletion
2
.../bytecode/fingerprints/SeekFingerprint.kt → ...controller/fingerprint/SeekFingerprint.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
2 changes: 1 addition & 1 deletion
2
...de/fingerprints/VideoLengthFingerprint.kt → ...ler/fingerprint/VideoLengthFingerprint.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
Oops, something went wrong.