diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 1cb6532..4a226cc 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -325,6 +325,33 @@ static BOOL findCell(ASNodeController *nodeController, NSArray *ide } %end +// Fixes uYou crash when trying to play video (#1422) +@interface YTVarispeedSwitchController : NSObject +@end + +@interface YTPlayerOverlayManager : NSObject +@property (nonatomic, assign) float currentPlaybackRate; +@property (nonatomic, strong, readonly) YTVarispeedSwitchController *varispeedController; + +- (void)varispeedSwitchController:(YTVarispeedSwitchController *)varispeed didSelectRate:(float)rate; +- (void)setCurrentPlaybackRate:(float)rate; +- (void)setPlaybackRate:(float)rate; +@end + +%hook YTPlayerOverlayManager +%property (nonatomic, assign) float currentPlaybackRate; + +%new +- (void)setCurrentPlaybackRate:(float)rate { + [self varispeedSwitchController:self.varispeedController didSelectRate:rate]; +} + +%new +- (void)setPlaybackRate:(float)rate { + [self varispeedSwitchController:self.varispeedController didSelectRate:rate]; +} +%end + // Hide search ads by @PoomSmart - https://github.com/PoomSmart/YouTube-X // %hook YTIElementRenderer // - (NSData *)elementData {