Playing audio from a .mov file with Swift - ios

Basically, my app allows the user to select a video from photo library, and I want to be able to play back the audio exclusively. However, AVAudioPlayer doesn't seem to accept .mov file paths, is there any way to work around this??

Related

AVAssetWriter: preview recorded .mp4 before calling `finishWriting`?

I am using AVAssetWriter to record a video (with audio) form iOS camera. Everything works great.
I now want to allow the user to preview the video before saving, meaning, before calling finishWriting on the AVAssetWriter instance.
My original thought was to copy the current file the writer is writing to during recoding to a preview url, and then use another AVAssetWriter to finalize that file and then play it.
However, I am not sure how to properly initialize a second AVAssetWriter for preview purposes, so I can call finishWriting on it at the preview url...
Anyone knows how I could implement preview functionality to allow a user to preview the currently recorded mp4 before calling finishWriting?
Anyone knows how I could implement preview functionality to allow a user to preview the currently recorded mp4 before calling finishWriting?
You must call finishWriting in order to have a viewable mp4 file.
So call finishWriting, let the user preview the resulting file and then decide whether to delete it or keep it.

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.

How to play audio with narration in iOS

I need to play audio file with text narrating the sound being played in my application. Is there any library for the proper sync of audio file with text or its subtitles. Any help will be much appreciated.

How to play .GIFV and .WEBM on iOS

I am making an reddit client app. So far I have been successfully able to play gif on iOS using FLAnimatedImage library. However for majority of the "gifs" now a days are "gifv" format from imgur and "webm" from gfycat.
Is there any way to play them on iOS? I researched and know that these 2 formats are just fancy videos. However even avplayer won't play them.
The official imgur app is able to play them so there has to be a way.
GIF formats are okay but problem arises for bigger files where we need to download the entire file first and that takes time. GIFV plays continuously without having to download the entire file. Hence I need someway to play them in my app.
#sschale thanks! yes, seems like imgur's gifv is basically mp4 video without audio. So I ended up using avplayer with each URL replaced with mp4 instead of gifv. Same webm replaced with mp4. Added a whole bunch of extra configuration for looping of video etc and got it to work seamlessly. In order for the avplayer to not pause background playing music of other apps, I added:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient withOptions:0 error:nil];

Record audio over a live video

I have a video file and I want to suppress the audio of the video file while playing and record my own audio through my iPad application. Can anyone suggest me the ways to achieve it?

Resources