AVComposition doesn't play via Airplay Video - ios

My AVMutableComposition which contains two locally stored video files plays fine on the iPad but cannot play via AirPlay Video.
My AVPlayer implementation works fine for regular AVURLAssets over AirPlay Video, just not for AVComposition assets.
Both locally stored video files play fine via Airplay Video when loaded as individual AVURLAssets.
Is this a limitation with AirPlay Video? Or is there something I need to do to the composition?

Related

AVPlayer audio out of sync after seek

I use PlayerKit in one app to stream video from Cloudinary.
Everything works fine until I use seek to move video forwards or backwards.
I pause the video, use seek to move it to time I wish. After that the video plays fine but audio only starts after 20-30 seconds and is out of sync.
I've tried waiting for it to buffer, and different options on AVPlayerItem, Asset and Player but to no avail. One thing I did notice is that audio is not buffered while video is paused, it starts buffering audio only when I play the video.
PlayerKit is just a wrapper for AVPlayer and uses AVPlayer methods and listeners to inform me of buffering time and playing state so it's not up to the pod.
I resolved it by switching from mp4 to m3u8.
m3u8 is a playlist information file so I was then able to stream from cloudinary instead.

m3u8 extension video file is not working with AVPlayer

I am using AVPlayer to play a video from server, the video has m3u8 extension , but the video is not loading, others extensions are working perfectly.

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.

Switch HLS video stream to audio when app goes in background

I am using HTTP Live Streaming Protocol to stream video and audio on demand in my app. The video playlist (m3u8 file) has an audio only version which is playing when the connection is very poor. When the app goes in background I want to play the audio of the video. Is there a way to achieve this, like forcing the MPMoviePlayer to switch to audio only, and then when they open the app to switch to a video version.

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