File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -378,16 +378,20 @@ -(MPRemoteCommandHandlerStatus) playOrPauseEvent: (MPSkipIntervalCommandEvent *)
378378 AVPlayer *player = playerInfo[@" player" ];
379379 bool _isPlaying = false ;
380380 NSString *playerState;
381- if (player.timeControlStatus == AVPlayerTimeControlStatusPlaying) {
382- // player is playing and pause it
383- [ self pause: _currentPlayerId ];
384- _isPlaying = false ;
385- playerState = @" paused" ;
386- } else if (player.timeControlStatus == AVPlayerTimeControlStatusPaused) {
387- // player is paused and resume it
388- [ self resume: _currentPlayerId ];
389- _isPlaying = true ;
390- playerState = @" playing" ;
381+ if (@available (iOS 10.0 , *)) {
382+ if (player.timeControlStatus == AVPlayerTimeControlStatusPlaying) {
383+ // player is playing and pause it
384+ [ self pause: _currentPlayerId ];
385+ _isPlaying = false ;
386+ playerState = @" paused" ;
387+ } else if (player.timeControlStatus == AVPlayerTimeControlStatusPaused) {
388+ // player is paused and resume it
389+ [ self resume: _currentPlayerId ];
390+ _isPlaying = true ;
391+ playerState = @" playing" ;
392+ }
393+ } else {
394+ // Fallback on earlier versions
391395 }
392396 [_channel_audioplayer invokeMethod: @" audio.onNotificationPlayerStateChanged" arguments: @{@" playerId" : _currentPlayerId, @" value" : @(_isPlaying)}];
393397
You can’t perform that action at this time.
0 commit comments