cordova-plugin-streaming-media icon indicating copy to clipboard operation
cordova-plugin-streaming-media copied to clipboard

IOS 13 issue - Player is closing and Audio is playing

Open desmeit opened this issue 4 years ago • 7 comments

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

desmeit avatar Sep 25 '19 10:09 desmeit

Could you solve the problem?

Durzan666 avatar Nov 20 '19 06:11 Durzan666

+1

attex avatar Dec 04 '19 13:12 attex

@Durzan666 yes, but i dont know why.

desmeit avatar Dec 04 '19 15:12 desmeit

@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?

attex avatar Dec 05 '19 06:12 attex

@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.

Durzan666 avatar Dec 05 '19 07:12 Durzan666

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

desmeit avatar Dec 05 '19 07:12 desmeit

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.

attex avatar Dec 05 '19 08:12 attex