When we play a media and call the "stop" method while the player is still idle or preparing, the player starts to play anyway
CALL STOP WHILE STILL IDLE AFTER PLAY METHOD IS CALLED
2017-07-27 11:20:41.406371+0200 [4698:1757814] WILL PLAY - PLAYBACKSTATE = 1
2017-07-27 11:20:41.409107+0200 [4698:1757814] DID PLAY - PLAYBACKSTATE = 1
2017-07-27 11:20:41.441540+0200 [4698:1757814] ...
2017-07-27 11:20:42.723282+0200 [4698:1757814] WILL ASK FOR STOP - PLAYBACKSTATE = 1
2017-07-27 11:20:42.723391+0200 [4698:1757814] DID ASK FOR STOP
2017-07-27 11:20:44.635106+0200 [4698:1757814] [Controller] Playing
2017-07-27 11:20:44.635328+0200 [4698:1757814] self.mediaPlayerController.playbackState 2
2017-07-27 11:20:44.639759+0200 [4698:1757814] [Controller] Playback state did change to preparing with info {
SRGMediaPlayerPlaybackStateKey = 2;
SRGMediaPlayerPreviousPlaybackStateKey = 1;
SRGMediaPlayerSelectionKey = 0;
}
2017-07-27 11:20:48.002316+0200 [4698:1757814] self.mediaPlayerController.playbackState 3
2017-07-27 11:20:48.014082+0200 [4698:1757814] [Controller] Playback state did change to playing with info {
SRGMediaPlayerPlaybackStateKey = 3;
SRGMediaPlayerPreviousPlaybackStateKey = 2;
SRGMediaPlayerSelectionKey = 0;
}
CALL STOP WHEN PREPARING
2017-07-27 11:22:35.166238+0200 [4702:1758624] WILL PLAY - PLAYBACKSTATE = 1
2017-07-27 11:22:35.169096+0200 [4702:1758624] DID PLAY - PLAYBACKSTATE = 1
2017-07-27 11:22:38.416480+0200 [4702:1758624] [Controller] Playing
2017-07-27 11:22:38.416945+0200 [4702:1758624] self.mediaPlayerController.playbackState 2
2017-07-27 11:22:38.417005+0200 [4702:1758624] WILL ASK FOR STOP - PLAYBACKSTATE = 2
2017-07-27 11:22:38.417188+0200 [4702:1758624] self.mediaPlayerController.playbackState 1
2017-07-27 11:22:38.425274+0200 [4702:1758624] [Controller] Playback state did change to idle with info {
SRGMediaPlayerPlaybackStateKey = 1;
SRGMediaPlayerPreviousPlaybackStateKey = 2;
SRGMediaPlayerSelectionKey = 0;
}
2017-07-27 11:22:38.425337+0200 [4702:1758624] DID ASK FOR STOP
2017-07-27 11:22:38.429552+0200 [4702:1758624] [Controller] Playback state did change to preparing with info {
SRGMediaPlayerPlaybackStateKey = 2;
SRGMediaPlayerPreviousPlaybackStateKey = 1;
SRGMediaPlayerSelectionKey = 0;
}
2017-07-27 11:22:41.804323+0200 [4702:1758624] self.mediaPlayerController.playbackState 3
2017-07-27 11:22:41.807534+0200 [4702:1758624] [Controller] Playback state did change to playing with info {
SRGMediaPlayerPlaybackStateKey = 3;
SRGMediaPlayerPreviousPlaybackStateKey = 1;
SRGMediaPlayerSelectionKey = 0;
}
Environment information
Library version: 2.0.3
iOS version: ANY
Device: ANY
Reproducibility
[X] Always reproducible
[ ] Difficult to reproduce
Code sample
- (void)playMedia
{
NSLog(@" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WILL PLAY - PLAYBACKSTATE = %tu", self.mediaPlayerController.playbackState);
[self.mediaPlayerController playURL:[NSURL URLWithString:@"..."]];
NSLog(@" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DID PLAY - PLAYBACKSTATE = %tu", self.mediaPlayerController.playbackState);
}
- (IBAction)stopPlayer:(id)sender
{
NSLog(@"WILL ASK FOR STOP - PLAYBACKSTATE = %tu", self.mediaPlayerController.playbackState);
[self.mediaPlayerController stop];
NSLog(@"DID ASK FOR STOP");
}
- (void)playbackStateDidChange:(NSNotification *)notification
{
if (self.mediaPlayerController.playbackState == SRGMediaPlayerPlaybackStatePreparing) {
[self stopPlayer:nil];
}
}
Steps to reproduce
Setup Network link conditionner to High latency or slow network (easier to reproduce)
Start playing a media
Immediately call stop when player is still preparing or idle
Wait a little while... the media will start to play
Issue overview
Description of the problem
When we play a media and call the "stop" method while the player is still idle or preparing, the player starts to play anyway
CALL STOP WHILE STILL IDLE AFTER PLAY METHOD IS CALLED
CALL STOP WHEN PREPARING
Environment information
Reproducibility
Code sample
Steps to reproduce