【问题标题】:Not Showing Movie, Black Screen Appears不显示电影,出现黑屏
【发布时间】:2014-03-19 14:58:10
【问题描述】:

我的电影播放器​​正在播放,但没有播放任何视频。它只播放声音。

我的代码如下:

    self.moviePlayer=[[MPMoviePlayerController alloc] initWithContentURL:nil];

    self.moviePlayer.view.frame=CGRectMake(10, (self.view.frame.size.height-200-64)/2, 300, 200);

    [self.moviePlayer setControlStyle:MPMovieControlStyleDefault];

    [self.moviePlayer setShouldAutoplay:YES];
    self.moviePlayer.allowsAirPlay = YES;
    self.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;

    self.moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
    self.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
     [self.moviePlayer setContentURL:[NSURL URLWithString:AttachmentUrl]];
    [self.view addSubview:self.moviePlayer.view];

    self.moviePlayer.fullscreen=YES;
    [self.moviePlayer prepareToPlay];

    [self.moviePlayer play];


    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlaybackComplete:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:self.moviePlayer];

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

请建议我需要做什么。

【问题讨论】:

    标签: ios objective-c mpmovieplayercontroller mpmovieplayer


    【解决方案1】:

    我的经验是最好用:MPMoviePlayerViewController

    例如:

    MPMoviePlayerViewController *mvPlayerController = [[MPMoviePlayerViewController alloc]
                                   initWithContentURL:[NSURL URLWithString:AttachmentUrl]];
    

    【讨论】:

      猜你喜欢
      • 2020-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-11
      • 2012-01-15
      • 2020-09-18
      相关资源
      最近更新 更多