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

Update transport bar when it becomes visible

The transport bar is being updated whenever the playback position has changed and when the transport bar is visible. This causes an old position being displayed when the playback is paused and the transport bar is not visible at that time. A previous commit fixed that problem by adding another update when the playback is paused. But this is not enough to fix all cases where the old value could be displayed. If the playback state is changing to buffering because there is a switch between two media, the bar is also not being updated. And there are probably more cases where this happens. This commit therefore takes a more general approach to solve the problem by updating the transport bar whenever it becomes visible.
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <>
parent 5088d8c1
......@@ -747,6 +747,11 @@ static const NSInteger VLCJumpInterval = 10000; // 10 seconds
if (self.bottomOverlayView.alpha == 0.0) {
[self animatePlaybackControlsToVisibility:YES];
// We need an additional update here because in some cases (e.g. when the playback was
// paused or started buffering), the transport bar is only updated when it is visible
// and if the playback is interrupted, no updates of the transport bar are triggered.
[self updateTransportBarPosition];
[self hidePlaybackControlsIfNeededAfterDelay];
......@@ -817,12 +822,6 @@ 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) {
......@@ -911,8 +910,9 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
#pragma mark -
- (void)updateTransportBarPosition:(VLCPlaybackController *)controller
- (void)updateTransportBarPosition
VLCPlaybackController *controller = [VLCPlaybackController sharedInstance];
VLCMediaPlayer *mediaPlayer = controller.mediaPlayer;
VLCTransportBar *transportBar = self.transportBar;
transportBar.remainingTimeLabel.text = [[mediaPlayer remainingTime] stringValue];
......@@ -926,7 +926,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self updateActivityIndicatorForState:VLCMediaPlayerStatePlaying];
if (self.bottomOverlayView.alpha != 0.0) {
[self updateTransportBarPosition:controller];
[self updateTransportBarPosition];
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