diff --git a/Sources/uYouPlusPatches.h b/Sources/uYouPlusPatches.h index b8734c0..1efe8d2 100644 --- a/Sources/uYouPlusPatches.h +++ b/Sources/uYouPlusPatches.h @@ -1,6 +1,15 @@ #import "../Tweaks/YouTubeHeader/YTCommonColorPalette.h" #import "uYouPlus.h" +@interface YTSingleVideoController : NSObject +-(float)playbackRate; +-(void)setPlaybackRate:(float)arg1; +@end + +@interface YTPlayerViewController : UIViewController +-(YTSingleVideoController *)activeVideo; +@end + // Prevent uYou player bar from showing when not playing downloaded media @interface PlayerManager : NSObject - (float)progress; diff --git a/Sources/uYouPlusPatches.xm b/Sources/uYouPlusPatches.xm index bf520a1..3df68de 100644 --- a/Sources/uYouPlusPatches.xm +++ b/Sources/uYouPlusPatches.xm @@ -80,6 +80,19 @@ %end %end +// Fix uYou playback speed crashes YT v18.49.3+, see https://github.com/iCrazeiOS/uYouCrashFix +%hook YTPlayerViewController +%new +-(float)currentPlaybackRateForVarispeedSwitchController:(id)arg1 { + return [[self activeVideo] playbackRate]; +} + +%new +-(void)varispeedSwitchController:(id)arg1 didSelectRate:(float)arg2 { + [[self activeVideo] setPlaybackRate:arg2]; +} +%end + // Fix streched artwork in uYou's player view - https://github.com/MiRO92/uYou-for-YouTube/issues/287 %hook ArtworkImageView - (id)imageView { @@ -196,5 +209,5 @@ BOOL isYTPlaybackActive = NO; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"disableAgeRestriction"]; // Disable uYou's playback speed controls (prevent crash on video playback https://github.com/therealFoxster/uYouPlus/issues/2#issuecomment-1894912963) - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"showPlaybackRate"]; + // [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"showPlaybackRate"]; } \ No newline at end of file