iOS 电影播放器控件在视频结束时跳转到播放器中间
我的应用程序使用 HTTP Live Streaming 来播放视频文件。我们遇到了一个问题,一旦流结束,播放器控件就会从播放器的底部跳到中间,如此屏幕截图所示(http://postimage.org/image/1dvr9u338/)。这是预期的行为吗?如果不是,对正在发生的事情有什么想法吗?
如果应用程序播放非实时流媒体视频(例如 mp4),则一切正常。但是,一旦我们播放实时流媒体视频 (m3u8),例如 Apple 的示例流媒体视频 (http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8)会出现此问题。
该应用程序支持 iOS 4.2+,每个版本都会出现该问题。我已经用一个全新的项目对此进行了测试,该项目仅嵌入 MPMoviePlayerController 的视图并播放视频。下面是一些示例代码,用于加载 contentURL、嵌入视图并播放视频。
- (void)viewDidLoad
{
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]];
moviePlayerController.view.frame = CGRectMake(100, 100, 600, 400);
[self.view addSubview:c.view];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidAppear:(BOOL)animated
{
[moviePlayerController play];
[super viewDidAppear:animated];
}
My application uses HTTP Live Streaming to play video files. We have run into a problem where as soon as the stream ends the player controls jump from the bottom of the player to the middle as seen in this screenshot (http://postimage.org/image/1dvr9u338/). Is this expected behavior and if not, any thoughts on what is happening?
If the application plays a non-live streaming video, such as an mp4, everything works fine. But as soon as we play a live-streaming video (m3u8), such as Apple's sample streaming video (http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8) this issue occurs.
The application supports iOS 4.2+ and the issue occurs on every version. I have tested this with a brand new project that just embeds an MPMoviePlayerController's view and plays the video. Below is some sample code that loads the contentURL, embeds the view, and plays the video.
- (void)viewDidLoad
{
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]];
moviePlayerController.view.frame = CGRectMake(100, 100, 600, 400);
[self.view addSubview:c.view];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidAppear:(BOOL)animated
{
[moviePlayerController play];
[super viewDidAppear:animated];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论