mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-01-11 22:40:19 +00:00
Add YTTapToSeek
This commit is contained in:
parent
5cd7dbffef
commit
3176101d5d
3 changed files with 39 additions and 0 deletions
|
|
@ -51,6 +51,19 @@
|
|||
@property (nonatomic, strong) UIView *_scrimOverlay;
|
||||
@end
|
||||
|
||||
// YTTapToSeek - https://github.com/bhackel/YTTapToSeek
|
||||
@interface YTInlinePlayerBarContainerView : UIView
|
||||
@property (nonatomic, weak, readwrite) id delegate;
|
||||
- (void)didPressScrubber:(id)arg1;
|
||||
- (CGFloat)scrubRangeForScrubX:(CGFloat)arg1;
|
||||
@end
|
||||
@interface YTMainAppVideoPlayerOverlayViewController : UIViewController
|
||||
- (CGFloat)totalTime;
|
||||
@end
|
||||
@interface YTPlayerViewController : UIViewController
|
||||
- (void)seekToTime:(double)time;
|
||||
@end
|
||||
|
||||
// uYouPlus
|
||||
@interface YTHeaderLogoController : UIView
|
||||
@property(readonly, nonatomic) long long pageStyle;
|
||||
|
|
|
|||
|
|
@ -491,6 +491,28 @@ static NSString *accessGroupID() {
|
|||
}
|
||||
%end
|
||||
|
||||
// YTTapToSeek - https://github.com/bhackel/YTTapToSeek
|
||||
%group YTTTS_Tweak
|
||||
%hook YTInlinePlayerBarContainerView
|
||||
- (void)didPressScrubber:(id)arg1 {
|
||||
%orig;
|
||||
// Get access to the seekToTime method
|
||||
YTMainAppVideoPlayerOverlayViewController *mainAppController = [self.delegate valueForKey:@"_delegate"];
|
||||
YTPlayerViewController *playerViewController = [mainAppController valueForKey:@"parentViewController"];
|
||||
// Get the X position of this tap from arg1
|
||||
UIGestureRecognizer *gestureRecognizer = (UIGestureRecognizer *)arg1;
|
||||
CGPoint location = [gestureRecognizer locationInView:self];
|
||||
CGFloat x = location.x;
|
||||
// Get the associated proportion of time using scrubRangeForScrubX
|
||||
double timestampFraction = [self scrubRangeForScrubX:x];
|
||||
// Get the timestamp from the fraction
|
||||
double timestamp = [mainAppController totalTime] * timestampFraction;
|
||||
// Jump to the timestamp
|
||||
[playerViewController seekToTime:timestamp];
|
||||
}
|
||||
%end
|
||||
%end
|
||||
|
||||
# pragma mark - Hide Notification Button && SponsorBlock Button && uYouPlus Button
|
||||
%hook YTRightNavigationButtons
|
||||
- (void)layoutSubviews {
|
||||
|
|
@ -1296,6 +1318,9 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
|
|||
if (IS_ENABLED(@"disableLiveChatSection_enabled")) {
|
||||
%init(gDisableLiveChatSection);
|
||||
}
|
||||
if (IS_ENABLED(@"YTTapToSeek_enabled")) {
|
||||
%init(YTTTS_Tweak);
|
||||
}
|
||||
|
||||
// YTNoModernUI - @arichorn
|
||||
BOOL ytNoModernUIEnabled = IS_ENABLED(@"ytNoModernUI_enabled");
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ extern NSBundle *uYouPlusBundle();
|
|||
|
||||
SWITCH_ITEM2(LOC(@"Enable Portrait Fullscreen (iPhone-Exclusive)"), LOC(@"Enables Portrait Fullscreen on the YouTube App. App restart is required."), @"portraitFullscreen_enabled");
|
||||
SWITCH_ITEM2(LOC(@"SLIDE_TO_SEEK"), LOC(@"SLIDE_TO_SEEK_DESC"), @"slideToSeek_enabled");
|
||||
SWITCH_ITEM2(LOC(@"Enable Tap To Seek"), LOC(@"Jump to anywhere in a video by single-tapping the seek bar"), @"YTTapToSeek_enabled");
|
||||
SWITCH_ITEM(LOC(@"DISABLE_DOUBLE_TAP_TO_SEEK"), LOC(@"DISABLE_DOUBLE_TAP_TO_SEEK_DESC"), @"doubleTapToSeek_disabled");
|
||||
SWITCH_ITEM2(LOC(@"SNAP_TO_CHAPTER"), LOC(@"SNAP_TO_CHAPTER_DESC"), @"snapToChapter_enabled");
|
||||
SWITCH_ITEM2(LOC(@"PINCH_TO_ZOOM"), LOC(@"PINCH_TO_ZOOM_DESC"), @"pinchToZoom_enabled");
|
||||
|
|
|
|||
Loading…
Reference in a new issue