I want play video in AVPlayer and WKWebView simultaneously.
For now when video in WKWebView starts AVPlayer get stops.
Thanks in advance.
If you want to play two videos simultaneously than use two AVPlayer to play each video.
Related
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)
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.
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...
In my application I have to play videos of type .m3u8. These are not local video. I can do it either with MPMoviePlayerController or AVPlayer. I also have to ignore userinteraction when some advertisement is getting played. Also I have to give an option for Airplay.
Which player should I use?
Thanks.
AVPlayer has a subclass called AVQueuePlayer which allows you to play back several movies in a sequence. It would be helpful for you for your ads. AVplayer currently does not support Airplay.
From iOS 5 AVplayer has an option to start playing back automatically on Airplay by enabling usesAirPlayVideoWhileAirPlayScreenIsActive property (if allowsAirPlayVideo is also enabled)
As far as I know you cannot play on airplay automatically with MPMoviePlayer, user has to tap on the Airplay icon.
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.