Browse Source

VLCPlayerDisplayController: Miniplayer: Check is player is setup

This makes the property playerIsSetup accessible in order to check
if the player is setup.

Indeed for the case of the miniplayer, we were basing the shown
state on the return values of libvlc `willPlay` and `isPlaying`.
This led to have inconsistency because of synchronization issues.

(closes #472)
Soomin Lee 6 years ago
parent
commit
7f96314268

+ 1 - 0
Sources/VLCPlaybackController.h

@@ -63,6 +63,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 @property (nonatomic, readonly) NSInteger mediaDuration;
 @property (nonatomic, readonly) BOOL isPlaying;
 @property (nonatomic, readonly) BOOL willPlay;
+@property (nonatomic, readonly) BOOL playerIsSetup;
 @property (nonatomic, readwrite) VLCRepeatMode repeatMode;
 @property (nonatomic, assign, getter=isShuffleMode) BOOL shuffleMode;
 @property (nonatomic, readwrite) float playbackRate; // default = 1.0

+ 0 - 1
Sources/VLCPlaybackController.m

@@ -47,7 +47,6 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
     VLCRemoteControlService *_remoteControlService;
     VLCMediaPlayer *_mediaPlayer;
     VLCMediaListPlayer *_listPlayer;
-    BOOL _playerIsSetup;
     BOOL _shouldResumePlaying;
     BOOL _sessionWillRestart;
 

+ 1 - 1
Sources/VLCPlayerDisplayController.m

@@ -260,7 +260,7 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
     VLCPlaybackController *playbackController = [VLCPlaybackController sharedInstance];
     UIView<VLCPlaybackControllerDelegate, VLCMiniPlayer> *miniPlaybackView = self.miniPlaybackView;
     const NSTimeInterval animationDuration = 0.25;
-    const BOOL activePlaybackSession = playbackController.isPlaying || playbackController.willPlay;
+    const BOOL activePlaybackSession = playbackController.isPlaying || playbackController.willPlay || playbackController.playerIsSetup;
     const BOOL miniPlayerVisible = miniPlaybackView.visible;
 
     BOOL needsShow = activePlaybackSession && !miniPlayerVisible;