我想通过App同时下载和流式传输和下载视频。 视频很重,所以转换成m4u8格式并使用VOD Live流媒体cocept在MPMoviePlayer中播放它们。 如何与palying一起下载直播视频。 你能建议我吗?
答案 0 :(得分:0)
以下是播放电影的代码,希望这很有用..
NSURL *fileURL = [NSURL URLWithString:@"<Video URL>"];
[self playMovie:fileURL];
-(IBAction)playMovie:(NSString *) theURL
{
NSURL *fileURL = [NSURL fileURLWithPath:theURL];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.useApplicationAudioSession = NO;
moviePlayerController.fullscreen = YES;
[moviePlayerController play];
}
- (void)moviePlaybackComplete:(NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view removeFromSuperview];
[moviePlayerController release];
}
使视频能够流式传输
查看更多Apple Live Streaming HTTP LIve Streaming