zoukankan      html  css  js  c++  java
  • An AVPlayerItem cannot be associated with more than one instance of AVPlayer错误

    An AVPlayerItem cannot be associated with more than one instance of AVPlayer

     

    An AVPlayerItem cannot be associated with more than one instance of AVPlayer 

    
    
    如果出现这个问题可以在初始化的时候不设置ContentURL
    moviePlayerController_ = [[MPMoviePlayerViewController alloc] init];
    moviePlayerController_.movieSourceType = MPMovieSourceTypeStreaming;
    [moviePlayerController_.moviePlayer setContentURL:url];


    原代码:(dingdone)

                NSString *titleStr = [mediaDic objectForKey:kMediaVideoTitleKey];

                NSURL *vodurl = [mediaDic objectForKey:kMediaVideoUrlKey];

                HGMoviePlayerViewController *mediaPlayerController = [[HGMoviePlayerViewController alloc] initWithFrame:self.view.bounds contentURL:vodurl initialType:HGMoviePlayerControlStyleFullScreen withController:nil];

                [mediaPlayerController alwaysHideComment:YES];

                [mediaPlayerController alwaysHideShare:YES];

                mediaPlayerController.contentTitle = titleStr;

                [AppNavigationController presentViewController:mediaPlayerController animated:YES completion:^{

                }];

    播放MP4文件会闪退,改为

       NSString *titleStr = [mediaDic objectForKey:kMediaVideoTitleKey];

                NSURL *vodurl = [mediaDic objectForKey:kMediaVideoUrlKey];

                HGMoviePlayerViewController *mediaPlayerController = [[HGMoviePlayerViewController alloc] initWithFrame:self.view.bounds contentURL:nil initialType:HGMoviePlayerControlStyleFullScreen withController:nil];

                [mediaPlayerController setContentURL:vodurl];

                [mediaPlayerController play];         

                [mediaPlayerController alwaysHideComment:YES];

                [mediaPlayerController alwaysHideShare:YES];

                mediaPlayerController.contentTitle = titleStr;

                [AppNavigationController presentViewController:mediaPlayerController animated:YES completion:^{

                }];

    闪退问题解决,黄底部分是修改的代码。


  • 相关阅读:
    MBProgressHUD上传照片进度提示
    -oN ,-oX,-oG
    nmap -sN -p 22,80 www.baidu.com
    22/tcp open|filtered ssh 80/tcp open|filtered http
    nmap -sS
    nmap -sT
    tcpdump --nnx tcp and host 192.168.10.9
    awk对列求和
    genlist -s 192.168.1.*
    /usr/local/sbin/fping -s www.baidu.com www.google.com
  • 原文地址:https://www.cnblogs.com/shanyimin/p/4704051.html
Copyright © 2011-2022 走看看