Commit 9d154a92 authored by Felix Paul Kühne's avatar Felix Paul Kühne

playback: some demuxers don't respect :start-time, so try to re-set the...

playback: some demuxers don't respect :start-time, so try to re-set the position after playback started if needed
parent 9ef81f43
......@@ -444,9 +444,14 @@
- (void)_playNewMedia
{
NSNumber *playbackPositionInTime = @(0);
if (self.mediaItem.lastPosition && [self.mediaItem.lastPosition floatValue] < .95) {
if (self.mediaItem.duration.intValue != 0)
playbackPositionInTime = @(self.mediaItem.lastPosition.floatValue * (self.mediaItem.duration.intValue / 1000.));
CGFloat lastPosition = .0;
NSInteger duration = self.mediaItem.duration.intValue;
if (self.mediaItem.lastPosition)
lastPosition = self.mediaItem.lastPosition.floatValue;
if (lastPosition < .95) {
if (duration != 0)
playbackPositionInTime = @(lastPosition * (duration / 1000.));
}
if (playbackPositionInTime.intValue > 0) {
[_mediaPlayer.media addOptions:@{@"start-time": playbackPositionInTime}];
......@@ -471,7 +476,11 @@
[self performSelectorInBackground:@selector(_updateExportedPlaybackInformation) withObject:nil];
_currentAspectRatioMask = 0;
_mediaPlayer.videoAspectRatio = NULL;
_mediaPlayer.videoAspectRatio = NULL;
/* some demuxers don't respect :start-time, so re-try here */
if (lastPosition < .95 && _mediaPlayer.position < lastPosition)
_mediaPlayer.position = lastPosition;
[self _resetIdleTimer];
_playerIsSetup = YES;
......
Markdown is supported
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