我想通过应用程序同时下载和流式传输和下载视频。有视频很重所以转换成 m4u8 格式并使用 VOD 实时流媒体 cocept 在 MPMoviePlayer 中播放它们。如何在播放时同时下载实时流媒体视频。你能建议我吗。
问问题
2488 次
1 回答
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];
}
使视频能够流式传输
- 视频应为 .mp4 格式。
- 所有视频都应使用 Mac 中的 Miro Video Converter(或类似转换器)进行转换,并使其兼容在 iPhone、iPad 和 Android 设备上播放。转换后的视频将在移动设备中播放。但是,只有在从服务器下载完整视频后,视频才会播放。
- 要制作视频流,必须将视频的元数据移动到视频的开头。为此,我们必须使用名为 Medadata mover 的工具对视频进行编码。
- 然后最终的视频与流媒体兼容并且能够在所有移动设备上播放。然后视频必须通过 FTP 传输到所需的虚拟主机。例如 demo.com/videos/test.mp4。
- 然后可以在 iPhone 或 android 应用程序中配置视频并进行流式传输。
查看 Apple Live Streaming HTTP实时流媒体的更多信息
于 2012-05-15T12:48:34.670 回答