Commit 1dd7fde4 authored by Benjamin Adolphi's avatar Benjamin Adolphi Committed by Felix Paul Kühne

tvOS: Fixed transport bar not being updated when playback is paused

On tvOS, when the playback is paused, the transport bar is not being updated. This is because the playbackPositionUpdated callback in the VLCFullscreenMovieTVViewController class only updates the transport bar in case it is visible. This makes sense as it does not need to be updated in case it is not visible. However, in case of the playback being paused, the mediaPlayerStateChanged callback of the VLCFullscreenMovieTVViewController class, which handles showing the transport bar, is called after the last playbackPositionUpdated callback. Because of that, the transport bar is displayed but it displays the old position of when the transport bar was last hidden.

This commit adds an additional update of the transport bar in case the playback is being paused.
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent c666fef0
......@@ -817,6 +817,12 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self hidePlaybackControlsIfNeededAfterDelay];
} else {
[self showPlaybackControlsIfNeededForUserInteraction];
// We need an additional update here in case the playback was paused because the transport bar is only updated when it
// is visible and if the playback is paused, no updates of the transport bar are triggered.
if (currentState == VLCMediaPlayerStatePaused) {
[self updateTransportBarPosition:controller];
}
}
if (controller.isPlaying && !self.bufferingLabel.hidden) {
......@@ -905,17 +911,22 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
#pragma mark -
- (void)playbackPositionUpdated:(VLCPlaybackController *)controller
- (void)updateTransportBarPosition:(VLCPlaybackController *)controller
{
VLCMediaPlayer *mediaPlayer = controller.mediaPlayer;
VLCTransportBar *transportBar = self.transportBar;
transportBar.remainingTimeLabel.text = [[mediaPlayer remainingTime] stringValue];
transportBar.markerTimeLabel.text = [[mediaPlayer time] stringValue];
transportBar.playbackFraction = mediaPlayer.position;
}
- (void)playbackPositionUpdated:(VLCPlaybackController *)controller
{
// FIXME: hard coded state since the state in mediaPlayer is incorrectly still buffering
[self updateActivityIndicatorForState:VLCMediaPlayerStatePlaying];
if (self.bottomOverlayView.alpha != 0.0) {
VLCTransportBar *transportBar = self.transportBar;
transportBar.remainingTimeLabel.text = [[mediaPlayer remainingTime] stringValue];
transportBar.markerTimeLabel.text = [[mediaPlayer time] stringValue];
transportBar.playbackFraction = mediaPlayer.position;
[self updateTransportBarPosition:controller];
}
}
......
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