Playing audio in the background when using a UIWebView - ios

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?

Related

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?

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.

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.

Airplay of audio using AVPlayer does not work in the background

I am doing audio playback using the AVPlayer class from a remote URL.
It plays fine if I just play to the headphones/built in speaker, but I am seeing some oddities with AirPlay.
When I change to use an AppleTV for AirPlay, it will stream the audio, but on my iphone the audio playback indicator (the small 'play' triangle in the top menu bar) disappears, and when I lock the phone instead of continuing in the background, it stops. (When playing normally, it plays in the background fine).
Why is the AVPlayer not working in the background for audio over AirPlay?
Is this what other see? Is there a way around it?
Ok - I dug through the apple dev forums and found a hint.
If you are using AVPlayer for audio only, and want it to work in the background while doing airplay, you need to disable the allowsAirPlayVideo setting.
Apparently AVPlayer on iOS 5+ assumes that it is playing back video via AirPlay, and so does not allow backgrounding, unless you explicitly disable video AirPlay.
Once you disable this (i.e. self.player.allowsAirPlayVideo = FALSE;) then your audio will still play via AirPlay, but now it will not be treated as video, only as audio, and so will allow the backgrounding to work.
Have you enable the 'Background Audio' mutlitasking setting in the app plist?

Resources