From 076967ab940bf9904e7268838591117a3b192e3d Mon Sep 17 00:00:00 2001 From: Dan <38832025+dayanch96@users.noreply.github.com> Date: Wed, 24 Apr 2024 02:56:40 +0300 Subject: [PATCH] Fixes uYou crash when trying to play video (#1422) (#1428) --- Sources/uYouPlus.xm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 {