mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-30 12:23:58 -04:00 
			
		
		
		
	Attempt seek gesture
This commit is contained in:
		| @@ -579,6 +579,7 @@ BOOL isTabSelected = NO; | |||||||
|     static float initialBrightness; |     static float initialBrightness; | ||||||
|     static BOOL isHorizontalPan = NO; |     static BOOL isHorizontalPan = NO; | ||||||
|     static NSInteger gestureSection = 0; // 1 for brightness, 2 for volume, 3 for seeking |     static NSInteger gestureSection = 0; // 1 for brightness, 2 for volume, 3 for seeking | ||||||
|  |     static CGFloat currentTime; | ||||||
|      |      | ||||||
|     if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { |     if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { | ||||||
|         // Get the gesture's start position |         // Get the gesture's start position | ||||||
| @@ -594,6 +595,7 @@ BOOL isTabSelected = NO; | |||||||
|             initialVolume = [[AVAudioSession sharedInstance] outputVolume]; |             initialVolume = [[AVAudioSession sharedInstance] outputVolume]; | ||||||
|         } else { |         } else { | ||||||
|             gestureSection = 3; // Bottom third: Seeking |             gestureSection = 3; // Bottom third: Seeking | ||||||
|  |             currentTime = self.currentVideoMediaTime; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         // Reset the horizontal pan flag |         // Reset the horizontal pan flag | ||||||
| @@ -641,9 +643,16 @@ BOOL isTabSelected = NO; | |||||||
|                 }); |                 }); | ||||||
|                  |                  | ||||||
|             } else if (gestureSection == 3) { |             } else if (gestureSection == 3) { | ||||||
|                 // Bottom third: Seek functionality (implement your seeking logic here) |                 // Bottom third: Seek functionality | ||||||
|                 // Example: Adjust playback position based on horizontal swipe |                 // Calculate a seek fraction based on the horizontal translation | ||||||
|                 // (Add your media player's seeking logic here) |                 CGFloat totalDuration = self.currentVideoTotalMediaTime; | ||||||
|  |                 CGFloat viewWidth = self.view.bounds.size.width; | ||||||
|  |                 CGFloat seekFraction = (translation.x / viewWidth); | ||||||
|  |                 // Seek to the new time based on the calculated offset | ||||||
|  |                 CGFloat sensitivityFactor = 1; // Adjust this value to make seeking less sensitive | ||||||
|  |                 seekFraction = sensitivityFactor * seekFraction; | ||||||
|  |                 CGFloat seekTime = currentTime + totalDuration * seekFraction; | ||||||
|  |                 [self seekToTime:seekTime]; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Bryce Hackel
					Bryce Hackel