我正在编写一个iPad应用程序。在这个应用程序中,我想在默认的Quicktime播放器中打开一个电影URL。当我尝试在浏览器中打开URL时,电影开始在浏览器中播放。如何在默认播放器中打开电影(这样我就可以播放暂停控件..)
非常感谢任何帮助。
由于 SAURABH
答案 0 :(得分:0)
最后我认为不可能在iPad上打开quicktime播放器。所以我在google上搜索并找到了MPMoviePlayerViewController类,这很好地解决了我的问题。
- (void)viewDidLoad {
NSString *url = [[NSBundle mainBundle]
pathForResource:@"Stock_Footage_Demobroadband"
ofType:@"mp4"];
MPMoviePlayerViewController *playerViewController =
[[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:url]];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:[playerViewController moviePlayer]];
[self.view addSubview:playerViewController.view];
//---play movie---
MPMoviePlayerController *player = [playerViewController moviePlayer];
[player play];
[super viewDidLoad]; }
- (void) movieFinishedCallback:(NSNotification*) aNotification {
MPMoviePlayerController *player = [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
[player stop];
[self.view removeFromSuperView];
[player autorelease]; }
我已经发布了一个完整的教程我的博客http://www.makebetterthings.com/blogs/iphone/play-video-on-iphone-and-ipad/