【问题标题】:Recover from buffering stopping MPMoviePlayer从缓冲停止 MPMoviePlayer 中恢复
【发布时间】:2015-05-22 19:17:38
【问题描述】:

我不确定要添加什么代码,所以请告诉我您需要查看的内容。我将MPMoviePlayerWidevine 结合使用。我遇到了电影停止播放的问题。我检查MoviePlaybackStates 并且很少,如果有的话。大多数时候它只是停止。我想相信它与缓冲有关。我正在播放视频,widevine 回调没有给我任何错误。任何想法我可以如何追踪这个或问题是什么?

【问题讨论】:

    标签: ios video streaming playing widevine


    【解决方案1】:

    您应该关注loadState 而不是playbackState。 这样做的方法是观察MPMoviePlayerLoadStateDidChangeNotification 通知,看看缓冲情况如何。

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadStateChanged:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil];
    

    初始化播放器之前的某个地方。

    -(void)loadStateChanged:(NSNotification *)notif
    {
    
        NSString *loadState=@"";
        switch (self.player.loadState) {
            case MPMovieLoadStateUnknown: {
                loadState=@"MPMovieLoadStateUnknown";
    
                break;
            }
            case MPMovieLoadStatePlayable: {
                loadState=@"MPMovieLoadStatePlayable";
    
                break;
            }
            case MPMovieLoadStatePlaythroughOK: {
                loadState=@"MPMovieLoadStatePlaythroughOK";
    
                break;
            }
            case MPMovieLoadStateStalled: {
    
                loadState=@"MPMovieLoadStateStalled";
                break;
            }
    
        }
    NSLog(@"%@", loadState);
    
    }
    

    【讨论】:

      猜你喜欢
      • 2023-03-20
      • 2010-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-14
      • 1970-01-01
      • 2012-08-05
      相关资源
      最近更新 更多