nchutchind / cordova-plugin-streaming-media

Simple plugin for loading full screen streaming video or audio.
MIT License
392 stars 284 forks source link

IOS 13 issue - Player is closing and Audio is playing #195

Open desmeit opened 5 years ago

desmeit commented 5 years ago

Since IOS 13 I have the following issue: If I start a HLS Video, the player starts and closes immediately afterwards. the audio continues to run but you can't see the player. Apparently the video is running in the background.

Warning: Attempt to present <LandscapeAVPlayerViewController: XXX> on <MainViewController: XXX> while a presentation is in progress!

I don't know if this warning has anything to do with it. Cordova-ios: 4.5.5 on Iphone X

Durzan666 commented 4 years ago

Could you solve the problem?

attex commented 4 years ago

+1

desmeit commented 4 years ago

@Durzan666 yes, but i dont know why.

attex commented 4 years ago

@Durzan666 did you do something with the plugin itself or did the bug just disappear?

I mean have you readded the platform or something, that might caused the plugin to work again?

Durzan666 commented 4 years ago

@attex In my case the CDVViewController had a NavigationController so the NavigationController had to present the player. So I changed

[self.viewController presentViewController:moviePlayer animated:YES completion:^(void){
        [moviePlayer.player play];
}];

to

if (self.viewController.navigationController != nil) {
        [self.viewController.navigationController presentViewController:moviePlayer animated:YES completion:^(void){
            [self->moviePlayer.player play];
        }];
} else {
        [self.viewController presentViewController:moviePlayer animated:YES completion:^(void){
            [self->moviePlayer.player play];
        }];
}

You can find my code changes here.

desmeit commented 4 years ago

@attex I worked with a framework and updated to the last version. then it worked. I think it was a bug in the javascript.

attex commented 4 years ago

I could fix it myself. Thanks anyway guys.

In my case the Eventlistener was thrown twice, so the function window.plugin.streamingMedia.streamVideo() was also called twice and caused the player to close immediately.