mirror of
https://github.com/YTLitePlus/YTLitePlus.git
synced 2026-01-11 22:40:20 +00:00
Add alternate seek; Improve smoothing hopefully
This commit is contained in:
parent
c82171f6e4
commit
bbee22218a
17 changed files with 50 additions and 17 deletions
|
|
@ -395,6 +395,8 @@ static const NSInteger YTLiteSection = 789;
|
|||
sensitivityPicker,
|
||||
// Toggle for haptic feedback
|
||||
BASIC_SWITCH(LOC(@"PLAYER_GESTURES_HAPTIC_FEEDBACK"), nil, @"playerGesturesHapticFeedback_enabled"),
|
||||
// Toggle for alternate seek method
|
||||
BASIC_SWITCH(LOC(@"PLAYER_GESTURES_SEEK_ALTERNATE"), LOC(@"PLAYER_GESTURES_SEEK_ALTERNATE_DESC"), @"gestureSeekAlternate_enabled"),
|
||||
];
|
||||
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"PLAYER_GESTURES_TITLE") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
|
||||
[settingsViewController pushViewController:picker];
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ typedef NS_ENUM(NSUInteger, GestureSection) {
|
|||
@property UIPanGestureRecognizer *scrubGestureRecognizer;
|
||||
@property (nonatomic, strong, readwrite) YTFineScrubberFilmstripView *fineScrubberFilmstrip;
|
||||
- (CGFloat)scrubXForScrubRange:(CGFloat)scrubRange;
|
||||
- (CGFloat)scrubRangeForScrubX:(CGFloat)scrubX;
|
||||
@end
|
||||
|
||||
// Hide Collapse Button - @arichornlover
|
||||
|
|
|
|||
|
|
@ -749,10 +749,6 @@ BOOL isTabSelected = NO;
|
|||
static CGFloat deadzoneStartingXTranslation;
|
||||
// Variable to track the X translation of the pan gesture after exiting the deadzone
|
||||
static CGFloat adjustedTranslationX;
|
||||
// Variable used to smooth out the X translation
|
||||
static CGFloat smoothedTranslationX = 0;
|
||||
// Constant for the filter constant to change responsiveness
|
||||
// static const CGFloat filterConstant = 0.1;
|
||||
// Constant for the deadzone radius that can be changed in the settings
|
||||
static CGFloat deadzoneRadius = (CGFloat)GetFloat(@"playerGesturesDeadzone");
|
||||
// Constant for the sensitivity factor that can be changed in the settings
|
||||
|
|
@ -791,9 +787,11 @@ BOOL isTabSelected = NO;
|
|||
float volumeSensitivityFactor = 3.0;
|
||||
float newVolume = initialVolume + ((translationX / 1000.0) * sensitivityFactor * volumeSensitivityFactor);
|
||||
newVolume = fmaxf(fminf(newVolume, 1.0), 0.0);
|
||||
// Improve smoothness - ignore if the volume is within 0.01 of the current volume
|
||||
// Improve smoothness - ignore if the volume is within a certain distance of the current volume,
|
||||
// but also allow it to change to 100% or to 0% when close to the edges
|
||||
CGFloat currentVolume = [[AVAudioSession sharedInstance] outputVolume];
|
||||
if (fabs(newVolume - currentVolume) < 0.01 && currentVolume > 0.01 && currentVolume < 0.99) {
|
||||
CGFloat changeThresh = 0.02;
|
||||
if ((fabs(newVolume - currentVolume) < changeThresh) && (currentVolume > changeThresh) && (currentVolume < (1-changeThresh))) {
|
||||
return;
|
||||
}
|
||||
// https://stackoverflow.com/questions/50737943/how-to-change-volume-programmatically-on-ios-11-4
|
||||
|
|
@ -812,18 +810,23 @@ BOOL isTabSelected = NO;
|
|||
// Calculate the new seek X position
|
||||
CGFloat sensitivityFactor = 1; // Adjust this value to make seeking more/less sensitive
|
||||
CGFloat newSeekXPosition = initialTimeXPosition + translationX * sensitivityFactor;
|
||||
// Create a CGPoint using this new X position
|
||||
CGPoint newSeekPoint = CGPointMake(newSeekXPosition, 0);
|
||||
// Send this to a seek method in the player bar controller
|
||||
[playerBarController didScrubToPoint:newSeekPoint];
|
||||
// Decide between seek methods
|
||||
if (IS_ENABLED(@"gestureSeekAlternate_enabled")) {
|
||||
// Alternate seek method used by uYou
|
||||
// Convert the new X position back to a fraction of the total time
|
||||
CGFloat newVideoFraction = [playerBar scrubRangeForScrubX:newSeekXPosition];
|
||||
// Calculate the new video time based on this fraction
|
||||
CGFloat newVideoTime = newVideoFraction * totalTime;
|
||||
[self seekToTime:newVideoTime];
|
||||
} else {
|
||||
// Vanilla YouTube seek method used when dragging the seek bar
|
||||
// Create a CGPoint using this new X position
|
||||
CGPoint newSeekPoint = CGPointMake(newSeekXPosition, 0);
|
||||
// Send this to a seek method in the player bar controller
|
||||
[playerBarController didScrubToPoint:newSeekPoint];
|
||||
}
|
||||
};
|
||||
|
||||
// Helper function to smooth out the X translation
|
||||
// CGFloat (^applyLowPassFilter)(CGFloat) = ^(CGFloat newTranslation) {
|
||||
// smoothedTranslationX = filterConstant * newTranslation + (1 - filterConstant) * smoothedTranslationX;
|
||||
// return smoothedTranslationX;
|
||||
// };
|
||||
|
||||
/***** Helper functions for running the selected gesture *****/
|
||||
// Helper function to run any setup for the selected gesture mode
|
||||
void (^runSelectedGestureSetup)(NSString*) = ^(NSString *sectionKey) {
|
||||
|
|
@ -959,7 +962,6 @@ BOOL isTabSelected = NO;
|
|||
isValidHorizontalPan = YES;
|
||||
deadzoneStartingXTranslation = translation.x;
|
||||
adjustedTranslationX = 0;
|
||||
smoothedTranslationX = 0;
|
||||
// Run the setup for the selected gesture mode
|
||||
switch (gestureSection) {
|
||||
case GestureSectionTop:
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "خيارات تراكب ضوابط الفيديو";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Опции за контрол на видеото";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Overlay-Optionen für Videosteuerungen";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Sección Media";
|
||||
"BOTTOM_SECTION" = "Sección Inferior";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Habilitar Retroalimentación Háptica";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opciones de superposición de controles de vídeo";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Options de l'overlay des contrôles vidéo";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "動画コントロールオーバーレイの設定";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Seção do Meio";
|
||||
"BOTTOM_SECTION" = "Seção Inferior";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Habilitar Feedback Tátil";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opções de Sobreposição de Controles de Vídeo";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opțiuni Overlay Controale Video";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options";
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Kontrol Seç.";
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
"MIDDLE_SECTION" = "Phần giữa";
|
||||
"BOTTOM_SECTION" = "Phần dưới";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Bật phản hồi xúc giác";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Lớp phủ video";
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
"MIDDLE_SECTION" = "Middle Section";
|
||||
"BOTTOM_SECTION" = "Bottom Section";
|
||||
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE" = "Alternate seek method";
|
||||
"PLAYER_GESTURES_SEEK_ALTERNATE_DESC" = "Use a different method that increases content visibility";
|
||||
|
||||
// Video controls overlay options
|
||||
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "影片區覆蓋按鈕設定";
|
||||
|
|
|
|||
Loading…
Reference in a new issue