开发者

Need a tutorial for iOS to play video files in my application [closed]

开发者 https://www.devze.com 2023-03-26 21:31 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expert开发者_如何学Cise, but this question will likely sol
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expert开发者_如何学Cise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

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:

  1. Downloading the video file from the web
  2. Storing it in a data store for my application (what structure / location)
  3. Playing this video from my data store
  4. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消