【问题标题】:How to catch exception from MPMoviePlayerController: "An AVPlayerItem cannot be associated with more than one instance of AVPlayer"如何从 MPMoviePlayerController 捕获异常:“一个 AVPlayerItem 不能与多个 AVPlayer 实例关联”
【发布时间】:2012-09-19 12:54:05
【问题描述】:

我们有一个应用程序,我们使用 MPMoviePlayerController 从第三方流式传输内容。有时,即使尚未设置,他们也会将流列为可用。问题是当我们尝试播放这样的流时,我们得到了错误:

“一个 AVPlayerItem 不能与多个 AVPlayer 实例关联”

如果我们播放各种样本流,比如来自 Apple 的样本流,效果会很好: http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8

是否有适当的方法来处理来自 MPMoviePlayerController 的这些错误?

Stackoverflow 上还有其他各种帖子涉及相同的问题,但各种解决方案只是删除有问题的流。在我们的情况下这是不可能的,我们需要在客户端处理这个......如果可能的话?

【问题讨论】:

    标签: xamarin.ios mpmovieplayercontroller


    【解决方案1】:

    当我得到完成的事件时,我设法通过处理 MPMoviePlayerController 来解决这个问题。然后它不再崩溃,所以我希望这是这样做的正确方法......

                notification = MPMoviePlayerController.Notifications
                .ObservePlaybackDidFinish((sender, args) => {
                    mp.Dispose();
                    mp = null;
                    if(notification != null)
                    {
                        notification.Dispose();
                        notification = null;
                    }
            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-13
      相关资源
      最近更新 更多