I am going to build an iOS app that will download video from my web services to play offline in the application.
I am looking for a tutorial that will show me the basics which will include:
- Downloading the video file from the web
- Storing it in a data store for my application (what structure / location)
- Playing this video from my data store
- What video format I require
Generally I use ASIHTTPRequest
to download things off the web, it is a great library that handles multithreading for you. It should give you a url. You can then play the video using the MPMoviePlayerController
class. The following is the code to play the video:
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[[player view] setFrame:[self.view bounds]]; // Frame must match parent view
[self.view addSubview:[player view]];
[player play];
[player release];
To download the video from web, you can use ASIHTTP framework. There are plenty of examples which will give you a head start.
After that you can follow this tutorial, to playback the stored video - Video Playback from within an iOS 4 iPad Application
精彩评论