How to combine 2 CMSampleBufferRef files? - iphone

I am trying to capture video using the AV foundation api's. I want to provide functionality to pause the video and restart it. I am trying figure out how to implement the pause feature will work. I was thinking about adding a button which will call the [session stopRunning] method. I would implement AVCaptureVideoDataOutput and capture CMSampleBufferRef each time the video is stopped. I then would like to combine all these into one file and then output it to the camera roll. Does this seem like the right approach?
OR
SHould i implement a pause button and capture video continuously and just throw away the frames when the user has the pause button clicked? If that was the case, then how would i do that?
Thanks in advance!

Instead i am looking into using AVAssetWriter instead of writing seperate vidoes and trying to merge them. Attempting the solution provided here # How do i pause video recording with iPhone SDK?

Related

Swift Creating a custom video player

I am creating an original video player in swift.The following are used PHPickerviewcontroller,AVPlayer
I was able to select a video from my camera roll and draw the video in the view I specified, but I am unable to control it.Control methods are assumed to be playback and stop by buttons and seek bar.
I am having trouble getting the seek bar and the video I called to work together. Can you please tell me what is the best way to do this? Thank you in advance.

iOS Capturing Video

I want to make an app for the iPhone with the ability to record video. One thing I want to do with the video once it's recorded, is to take the audio from it and alter it, such as make it sound feminine or masculine etc. I've never done this before but is it better to use AVFoundation or UIImagePickerController. I've read that the UIImagePickerController is easier to use but will it allow be to extract and edit the audio of the recorded video and put it back in?
Any help or suggestions as to how to approach this are appreciated.
Thanks
It is easiest to capture with UIImagePickerController if you do not need to alter it live. Once the video is captured and you have altered the audio track somehow, write it again using AVFoundation's AVMutableComposition and an audio mix.

Playing a movie file and then various audio files while movie is playing back. (iOS)

Is it possible to play some audio files while my movie is playing. I don't want it to interrupt or pause he movie. Just the audio to play at same time at various predetermined points.
Many Thanks,
-Code
You shouldn't have any problems with it.
If you want to synchronize or delay these players you should use
the code they provide in AvAudioPlayer Class Reference using
playAtTime: method.
Sadly MPMediaPlayback protocol doesn't provide the same method
so exact synchronizing with video is a bit harder task.
EDIT: RoLYroLLs mentions using MPMoviePlayerLoadStateDidChangeNotification to achieve this here and this approach seems promising.
Use two or three Audioplayer at same time . Play that audio when u need it

MPMoviePlayerController - handle phone call

I'm using MPMoviePlayerController to play a video.
When a call comes, i want to pause and when he completes, i want to continue the video.
I couldn't find relevant solution in my search.
Is this something possible?
Its possible to handle the interruptions using AVAudioSessionDelegate "beginInterruption" and "endInterruption". But when I am setting the session to play back, my movie player sound is not heard at all.
Does any one know the solution?
There is a callEventHandler in Core Telephony framework. I hope, You could find what you want here.
We've to set the session active after endInterruption.

Combine two audio files together and play them in iPhone

I do not want any code but want to get a reference about my question mentioned below...
There is background music available and there is recording option in my app...
Once I start recording , application records my sound and when play button clicks , It will play the recording along with the background music...
I had use this Link but can not get as I want...
I think there is a mechanism like merging two audio files and make it one before playing....
How can I achieve this by coding... Is there any reference link or any sample code available?
Thnx in advance...
Most people mistake the one instance of AVAudioPlayer as the unit that plays the sound directly, but it doesnt. Mixing is done by the OS, not by the instance of AVAudioPlayer.
With other words:
No one says you can't have more then one AVAudioPlayer.
Create one for you background and let it play. Create another instance of AVAudioPlayer for you recorded sound and let it play. Voila