movieURL = [NSURL URLWithString:@"http://122.165.71.249:6060/test/music/killbill.mp3"];
// Setup the player
moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];我正在使用此代码播放在线连接,但我想离线也播放在视频网址链接。
发布于 2011-06-29 21:26:15
你必须自己使用NSURLConnection下载文件,然后你可以在下载视频的同时使用电影播放器的原始网址。当我这样做的时候,我试图让视频播放器在我完成之前使用本地文件,在收到一定数量的字节后延迟开始播放,但我发现它只能在模拟器上运行,而不能在实际的iPhone/iPodTouch上运行。如果你真的搜索(MPMoviePlayerViewController "Nathan Day“缓存),你会看到我在苹果Cocoa邮件上发布的一些示例代码,试图解决这个问题。
https://stackoverflow.com/questions/6521048
复制相似问题