需要iOS教程才能在我的应用程序中播放视频文件 [英] Need a tutorial for iOS to play video files in my application
本文介绍了需要iOS教程才能在我的应用程序中播放视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我打算构建一个iOS应用程序,它将从我的Web服务下载视频,以便在应用程序中离线播放。
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
推荐答案
一般情况下,我使用 ASIHTTPRequest
从网上下载东西,它是一个很棒的库,可以为你处理多线程。它应该给你一个网址。然后,您可以使用 MPMoviePlayerController
类播放视频。以下是播放视频的代码:
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];
这篇关于需要iOS教程才能在我的应用程序中播放视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文