Преглед на файлове

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 <fkuehne@videolan.org>
Benjamin Adolphi преди 9 години
родител
ревизия
1dd7fde409
променени са 1 файла, в които са добавени 16 реда и са изтрити 5 реда
  1. 16 5
      Apple-TV/Playback/VLCFullscreenMovieTVViewController.m

+ 16 - 5
Apple-TV/Playback/VLCFullscreenMovieTVViewController.m

@@ -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];
     }
 }