iOS 电影播放器​​控件在视频结束时跳转到播放器中间

发布于 2024-11-27 14:58:47 字数 1152 浏览 11 评论 0原文

我的应用程序使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文