prevent avplayer from pausing other videos (ie. videos playing in a wkwebview) - ios

I have a video playing in a wkwebview.
If I start another video playing in a native avplayer instance the wkwebview video pauses. And vice-versa.
This is within a single app.
Is there a way to allow both to keep playing?

I resolved the issue, placing this line
AVudioSession.sharedInstance().setCategory(.playback, options: [.duckOthers])
at the start of the app (ie. the SceneDelegate)

Related

AVPlayerViewController video's audio background playing and support for multiple formats

I have to do a Video streaming app (using a remote url) in swift. But there is no any exact video format. Sometimes it can be m3u8 sometimes mp4 etc.. but my video player should support for what ever the format comes from the back end.
Also when the app is in background, the audio should play and when the app comes foreground video should play without any time delay between the vide and the audio.
I want to know whether is it possible to achieve my objectives using AVPlayerViewController or else what is the best player that I can use to achieve my targets. Please help me.
Thanks
AVPlayerViewController supports m3u8 and mp4 both format. For playing video's audio you need some extra configuration. You can check from here...
How do I get my AVPlayer to play while app is in background?
Is it possible to play video using Avplayer in Background?
So according to me AVPlayerViewController is best option for your requirement.

iOS : Embed video in WKWebView stop music in background

I have an issue with WKWebView and the inter-app audio.
Let me explain the situation:
I have an application like spotify which plays music in background
I have an app which can open a webview (a WKWebView) and play video like youtube or just a sound.
When the video or sound is playing in the webview the background music is stopped as well
I have already configured my app to be able to mix sounds, in my app, I have also a player and when I start my player the background music is not stopped.
Very weird compartment because if I use UIWebView, the background music is not stopped when the embed video is starting in the webview.
Why there is a difference between UIWebView and WKWebView? Have you ever had this issue? Is there a fix for this issue?
When the video is playing in the WKWebView at iOS10 the background music does not stop.
I think it's a bug...

Play Audio from URL ios

I am developing application like gaana.com
Which player can be used for play mp3 songs from server url ? I want
to implement Play, Pause, Next, Previous buttons And will also play
song list in background mode one by one.
I have already implemented AVPlayer but i getting issue in playing
next audio in background mode. And i had tried all answers regarding
this issue but none of all is working for me.
So i am finding alternative of AVPlayer.

Playing audio in the background when using a UIWebView

So I´ve don all the preliminary steps of setting the audioSession sharedInstance category, and activated playing audio in the background in the info.plist file
However I am using an UIWebView to display YouTube, and even thought background playing is
supported, pressing the home button the audio stops. Is this cause YouTube uses some built in player? cause when I play an video my tab bar controller disappears.
Is there a way of having it continue playing the youtube videos in background?

avaudioplayer interferes with mpmovieplayer on ipad

my app plays video and audio. however, i have a problem where once i play an audio file using avaudioplayer, the video refuses to play. when i play the video first, everything is fine. but if the audio is played first, any time i try to play the video it simply pops up the video player but will not play the actual video (you can use the scroller to go to any point in the video, but no playback will happen). this issue does not come up on the iphone, nor on the ipad simulator. clearly there is some resource conflict here, probably related to the audio, and i'd welcome some input on how to address it.
issue solved: i had to call the 'stop' rather than 'pause' method on the avaudioplayer before video playback. this undoes the play preparation and releases the audio resource that had apparently prevented the video from being played.

Resources