Actually prevent uYou's playback from colliding with YouTube's

This commit is contained in:
Foxster
2024-01-28 09:53:08 -08:00
parent 61e55e1b15
commit 880603f7f4
2 changed files with 14 additions and 7 deletions
+9 -6
View File
@@ -173,14 +173,17 @@ static void refreshUYouAppearance() {
%end
// Prevent uYou's playback from colliding with YouTube's
BOOL isYTPlaybackActive = NO;
%hook HAMPlayerInternal
- (void)play { %orig; isYTPlaybackActive = YES; }
- (void)terminate { %orig; isYTPlaybackActive = NO; }
%hook PlayerVC
- (void)close {
%orig;
[[%c(PlayerManager) sharedInstance] setSource:nil];
}
%end
%hook PlayerManager
%hook HAMPlayerInternal
- (void)play {
if (isYTPlaybackActive) return;
dispatch_async(dispatch_get_main_queue(), ^{
[[%c(PlayerManager) sharedInstance] pause];
});
%orig;
}
%end