iOS : Embed video in WKWebView stop music in background - ios

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

Related

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

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)

SFSafariViewController: Audio stops on background

I play audio from a webpage using SFSafariViewController and when the app goes to background, the audio stops.
It happens when user blocks the screen as well.
Any ideas how to keep audio playing?

Is it Possible to play video in UIwebView while app in Background mode?

In my app i have UIWebView in which i had give option to user for watch video from video hosting sites(i.e. Youtube, Vimeo, DailyMotion). When I click Home button the app goes to background mode, the video is paused.
I wants to Play sound of that video while app in background mode.
I had implemented same while play local video in AVPlayer. But till now having no luck to achieve this.
I already refereed below stuff:
--> UIWebView: HTML5 audio pauses in iOS 6 when app enters background
--> Is it possible to play video using Avplayer in Background?
If you guys have any solution with this it will be great help.

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?

iOS 6 AVAudioSession issue

In my application I have made [audioSession setCategory:AVAudioSessionCategoryPlayback] to play audio in back ground and also to mute other audio play backs while playing song in my application. I am playing the audio using AVPlayer and also I have UIWebView for playing video in same Application. The issue arises when I play both video in web view and audio using AVPlayer. The music mixes in this case. Prior to iOS 6 when I rech same situation one audio pauses automatically and the mixing up does not occur. So kindly suggest some solutions.
Try to set
Required background modes -> App plays audio
in Info.plist.

Resources