Commit 09e05855 authored by Tobias's avatar Tobias
Browse files

workaround issue with [VLCMediaPlayer setTime:]

parent 6e7615b3
...@@ -366,7 +366,7 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds ...@@ -366,7 +366,7 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds
VLCMediaPlayer *player = vpc.mediaPlayer; VLCMediaPlayer *player = vpc.mediaPlayer;
if (player.isPlaying) { if (player.isPlaying) {
[player jumpForward:VLCJumpInterval]; [self jumpInterval:VLCJumpInterval];
} else { } else {
[self scrubbingJumpInterval:VLCJumpInterval]; [self scrubbingJumpInterval:VLCJumpInterval];
} }
...@@ -377,12 +377,27 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds ...@@ -377,12 +377,27 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds
VLCMediaPlayer *player = vpc.mediaPlayer; VLCMediaPlayer *player = vpc.mediaPlayer;
if (player.isPlaying) { if (player.isPlaying) {
[player jumpBackward:VLCJumpInterval]; [self jumpInterval:-VLCJumpInterval];
} else { } else {
[self scrubbingJumpInterval:-VLCJumpInterval]; [self scrubbingJumpInterval:-VLCJumpInterval];
} }
} }
- (void)jumpInterval:(NSInteger)interval
{
NSInteger duration = [VLCPlaybackController sharedInstance].mediaDuration;
if (duration==0) {
return;
}
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
VLCMediaPlayer *player = vpc.mediaPlayer;
CGFloat intervalFraction = ((CGFloat)interval)/((CGFloat)duration);
CGFloat currentFraction = player.position;
currentFraction += intervalFraction;
player.position = currentFraction;
}
- (void)scrubbingJumpInterval:(NSInteger)interval - (void)scrubbingJumpInterval:(NSInteger)interval
{ {
NSInteger duration = [VLCPlaybackController sharedInstance].mediaDuration; NSInteger duration = [VLCPlaybackController sharedInstance].mediaDuration;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment