@@ -501,53 +501,34 @@ static NSString *accessGroupID() {
501501// YTSpeed - https://github.com/Lyvendia/YTSpeed
502502%group gYTSpeed
503503%hook YTVarispeedSwitchController
504- - (instancetype )init {
505- if ((self = %orig )) {
506- const int size = 17 ;
504+ - (id )init {
505+ id result = %orig ;
506+
507+ const int size = 17 ;
507508 float speeds[] = {0.25 , 0.5 , 0.75 , 1.0 , 1.25 , 1.5 , 1.75 , 2.0 , 2.25 , 2.5 , 2.75 , 3.0 , 3.25 , 3.5 , 3.75 , 4.0 , 5.0 };
508509 id varispeedSwitchControllerOptions[size];
509510
510- for (int i = 0 ; i < size; ++i) {
511- id title = [NSString stringWithFormat: @" %.2f x" , speeds[i]];
512- varispeedSwitchControllerOptions[i] = [[%c (YTVarispeedSwitchControllerOption) alloc ] initWithTitle: title rate: speeds[i]];
513- }
511+ for (int i = 0 ; i < size; ++i) {
512+ id title = [NSString stringWithFormat: @" %.2f x" , speeds[i]];
513+ varispeedSwitchControllerOptions[i] = [[%c (YTVarispeedSwitchControllerOption) alloc ] initWithTitle: title rate: speeds[i]];
514+ }
514515
515- NSUInteger count = sizeof (varispeedSwitchControllerOptions) / sizeof (id );
516- NSArray *varispeedArray = [NSArray arrayWithObjects: varispeedSwitchControllerOptions count: count];
517- MSHookIvar<NSArray *>(self, " _options" ) = varispeedArray;
518- }
519- return self;
520- }
521- %end
516+ NSUInteger count = sizeof (varispeedSwitchControllerOptions) / sizeof (id );
517+ NSArray *varispeedArray = [NSArray arrayWithObjects: varispeedSwitchControllerOptions count: count];
518+ MSHookIvar<NSArray *>(self, " _options" ) = varispeedArray;
522519
523- %hook YTLocalPlaybackController
524- - (instancetype )initWithParentResponder:(id )parentResponder overlayFactory:(id )overlayFactory playerView:(id )playerView playbackControllerDelegate:(id )playbackControllerDelegate viewportSizeProvider:(id )viewportSizeProvider shouldDelayAdsPlaybackCoordinatorCreation:(BOOL )shouldDelayAdsPlaybackCoordinatorCreation {
525- float savedRate = [[NSUserDefaults standardUserDefaults ] floatForKey: @" YoutubeSpeed_PlaybackRate" ];
526- if ((self = %orig )) {
527- MSHookIvar<float >(self, " _restoredPlaybackRate" ) = savedRate == 0 ? DEFAULT_RATE : savedRate;
528- }
529- return self;
530- }
531- - (void )setPlaybackRate:(float )rate {
532- %orig ;
533- [[NSUserDefaults standardUserDefaults ] setFloat: rate forKey: @" YoutubeSpeed_PlaybackRate" ];
520+ return result;
534521}
535522%end
536523
537524%hook MLHAMQueuePlayer
538- - (instancetype )initWithStickySettings:(id )stickySettings playerViewProvider:(id )playerViewProvider {
539- id result = %orig ;
540- float savedRate = [[NSUserDefaults standardUserDefaults ] floatForKey: @" YoutubeSpeed_PlaybackRate" ];
541- [self setRate: savedRate == 0 ? DEFAULT_RATE : savedRate];
542- return result;
543- }
544525- (void )setRate:(float )rate {
545- MSHookIvar<float >(self, " _rate" ) = rate;
526+ MSHookIvar<float >(self, " _rate" ) = rate;
546527 MSHookIvar<float >(self, " _preferredRate" ) = rate;
547528
548529 id player = MSHookIvar<HAMPlayerInternal *>(self, " _player" );
549530 [player setRate: rate];
550-
531+
551532 id stickySettings = MSHookIvar<MLPlayerStickySettings *>(self, " _stickySettings" );
552533 [stickySettings setRate: rate];
553534
@@ -557,6 +538,13 @@ static NSString *accessGroupID() {
557538 [singleVideoController playerRateDidChange: rate];
558539}
559540%end
541+
542+ %hook YTPlayerViewController
543+ %property (nonatomic, assign) float playbackRate;
544+ - (void )singleVideo:(id )video playbackRateDidChange:(float )rate {
545+ %orig ;
546+ }
547+ %end
560548%end
561549
562550# pragma mark - uYouPlus
@@ -654,22 +642,13 @@ static NSString *accessGroupID() {
654642%end
655643
656644// Hide Channel Watermark
657- %hook YTMainAppVideoPlayerOverlayView
658- - (BOOL )isWatermarkEnabled {
659- if (IS_ENABLED (@" hideChannelWatermark_enabled" )) {
660- return NO ;
661- }
662- return %orig ;
663- }
664- - (void )setFeaturedChannelWatermarkImageView:(id )imageView {
665- if (IS_ENABLED (@" hideChannelWatermark_enabled" )) {
666- return ;
667- }
668- %orig (imageView);
645+ %hook YTColdConfig
646+ - (BOOL )iosEnableFeaturedChannelWatermarkOverlayFix {
647+ return IS_ENABLED (@" hideChannelWatermark_enabled" ) ? NO : %orig ;
669648}
670649%end
671650
672- // Hide Channel Watermark (for Backwards Compatibility)
651+ // Hide Channel Watermark (for Old YouTube Versions / Backwards Compatibility)
673652%hook YTAnnotationsViewController
674653- (void )loadFeaturedChannelWatermark {
675654 if (IS_ENABLED (@" hideChannelWatermark_enabled" )) {}
0 commit comments