mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-21 16:02:00 +00:00
add YTSpeed
This commit is contained in:
parent
18ce6e99c5
commit
5a7189fb95
1 changed files with 47 additions and 0 deletions
47
uYouPlus.xm
47
uYouPlus.xm
|
|
@ -1049,6 +1049,53 @@ void center() {
|
||||||
centerYConstraint.active = YES;
|
centerYConstraint.active = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// YTSpeed - https://github.com/Lyvendia/YTSpeed
|
||||||
|
%hook YTVarispeedSwitchController
|
||||||
|
- (id)init {
|
||||||
|
id result = %orig;
|
||||||
|
|
||||||
|
const int size = 12;
|
||||||
|
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};
|
||||||
|
id varispeedSwitchControllerOptions[size];
|
||||||
|
|
||||||
|
for (int i = 0; i < size; ++i) {
|
||||||
|
id title = [NSString stringWithFormat:@"%.2fx", speeds[i]];
|
||||||
|
varispeedSwitchControllerOptions[i] = [[%c(YTVarispeedSwitchControllerOption) alloc] initWithTitle:title rate:speeds[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSUInteger count = sizeof(varispeedSwitchControllerOptions) / sizeof(id);
|
||||||
|
NSArray *varispeedArray = [NSArray arrayWithObjects:varispeedSwitchControllerOptions count:count];
|
||||||
|
MSHookIvar<NSArray *>(self, "_options") = varispeedArray;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
%hook MLHAMQueuePlayer
|
||||||
|
- (void)setRate:(float)rate {
|
||||||
|
MSHookIvar<float>(self, "_rate") = rate;
|
||||||
|
MSHookIvar<float>(self, "_preferredRate") = rate;
|
||||||
|
|
||||||
|
id player = MSHookIvar<HAMPlayerInternal *>(self, "_player");
|
||||||
|
[player setRate: rate];
|
||||||
|
|
||||||
|
id stickySettings = MSHookIvar<MLPlayerStickySettings *>(self, "_stickySettings");
|
||||||
|
[stickySettings setRate: rate];
|
||||||
|
|
||||||
|
[self.playerEventCenter broadcastRateChange: rate];
|
||||||
|
|
||||||
|
YTSingleVideoController *singleVideoController = self.delegate;
|
||||||
|
[singleVideoController playerRateDidChange: rate];
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
|
%hook YTPlayerViewController
|
||||||
|
%property float playbackRate;
|
||||||
|
- (void)singleVideo:(id)video playbackRateDidChange:(float)rate {
|
||||||
|
%orig;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
|
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
|
||||||
%group iOS16
|
%group iOS16
|
||||||
%hook OBPrivacyLinkButton
|
%hook OBPrivacyLinkButton
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue