How to place a resourse in the applicationDocumentsDirectory - iphone

I have an App that will come with a video clip. The user will be able to add video clips at a later stage. These will end up in the applicationDocumentsDirectory.
How, and where, do I place the first clip so it ends up in the right place? The clip is about 25Mb so I don't really want to duplicate it.

You have to include your video clip in application bundle. And now you have several choices ...
1) Modify video clips list
When your application will be creating list of local video clips for the user, just prepend this bundled video clip to this list.
2) Copy
You can copy your video clip from application bundle to application documents directory during application startup. If it isn't already there. But this will duplicate your video clip on device - space wasting. Maybe you can link it only, but I didn't try it on iOS.

Related

Using a webview to play an mp3- is it possible to keep it playing even when the screen is locked?

I have a portion of my app that simply launches a webview linked to an mp3 file- it opens the file and plays the audio. What I'd like to do is allow that audio to continue playing even if the user locks their iPhone. (As a side note, is there any way to replace the default Quicktime logo that appears in the player? Not that big a deal, just thought I'd ask =)
A third question- I also do the same thing (webview) with an .m3u linked file to stream live audio throughout the week- is it also possible to keep it playing when the iPhone is locked?
Thanks!!
Ben
Quick Edit: The same URLs work great in IOS Safari (locking and unlocking doesn't affect the audio. Just not in my app's webviews.
I did find my answer though, in case anyone comes here looking. Easiest thing in the world too- just add a row to the plist file labeled "Required Background Modes" and under that set item 0's value to "App plays audio". Voila!
Since the audio is in a UIWebView, I don't believe that you'd be able to play it in the background.
EDIT: I was wrong, adding "App Plays Audio" to the UIBackgroundModes will make it work even when audio is in a UIWebView.
Have you thought about just streaming the .mp3 file yourself? Should be easy enough and you'd be able to setup background streaming. To get you started, I'd check out Matt Gallagher's AudioStreamer class which easily allows you to stream .mp3 files and other audio files from the net: https://github.com/mattgallagher/AudioStreamer

Recording video with option of manipulating the pixels before writing to file

I know that I can access raw video images from the iPhone's camera with AVCaptureVideoDataOutput. I also know that I can record video to a file with AVCaptureMovieFileOutput. But how can I first access the raw video images, manipulate them and then write the manipulated ones into the video file? I've already seen apps in the app store, which do this, so it must be possible.
Ok, I now know, that it's done with AVAssetWriter.

How to record a video automatically in Iphone app without user interaction

I am working an iphone app that needs to record a vedio automatically.
I used mobile coreservices framework and using that. I made it to came into video mode and clicking on record option its start capturing a vedio. But I want it automatically that is.. I should able to record a video without clicking on record option. That is when video mode comes up its automatically start record video.
Could any one help?
You can look at UIImagePickerControllers startVideoCapture method which is used to start taking video from the camera, this is to be used when you arent using the camera standard controlors and you provide and overlay view. Here is a reference UIImagePickerCOntroller ref. If this is not enough for you, you might want to look into AVFoundation framework which gives you a lot more control over video capturing process...hope that helps

Is there an easy way to stream a m3u in iPhone?

I can have a UIWebView with the .m3u file opened, which will go to the webview with a play button displayed, and that automatically goes to the quicktime player and starts playing the stream. But when I press the done button, it goes back to the UIWebView with a little play button in the middle, and from there you can go back to the previous screen (it was selected from a tableview). So I just want it to automatically load the quicktime player in the view. How can I do that?
An m3u file is nothing more than a text file listing MP3 (and / or other format) digital audio files to be interpreted by player software as a series of audio files to be played in succession. So my best guess (I am about to implement this myself, so I'll find out soon if it actually works that way) at going about this is:
read in m3u file
parse for stream URLs and store these
choose / let user decide which one to play
Implement streaming player like explained here.
There is no step 5. I hope.

How to step frames in a movie recorded by iPhone

Is there a way to have my iPhone program step frame by frame through a movie recorded by the iPhone? What I want to do is have the user record a quicktime movie, then be able to step through the movie frame by frame.
Alternately, I suppose if there was a way to extract every single frame from the movie to a jpg, then I could easily step through the pictures. Anyone know of a way to do this???
I suppose the third option (which might not get past Apple's store) is to capture the movie the way the old jailbroken apps did, which is somehow capture the pictures directly from the camera view????
Any help appreciated. Thanks in advance!!!!
You cannot step through a movie frame by frame. That functionality does not exist in the public API.
You can include your own media decoder code (open source or not) and use that to parse your movies of course. It is perfectly fine to do that.