【问题标题】:MPMoviePlayerViewController playing only audio no video on simulator?MPMoviePlayerViewController 在模拟器上只播放音频而不播放视频?
【发布时间】:2010-10-04 11:23:01
【问题描述】:

我正在使用以下代码从 url 播放视频,但是当视频加载时仅播放音频并且模拟器上没有显示视频..现在我无法在 iphone 4.0 上测试它设备...模拟器有问题还是 MPMoviePlayerViewController 方法不对??

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];


[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playbackFinishedCallback:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:movie];

[self presentMoviePlayerViewControllerAnimated:movie];

【问题讨论】:

    标签: ios4 mpmovieplayercontroller


    【解决方案1】:

    试试这个

    NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
    NSURL *videoURL = [NSURL URLWithString:videoFilepath ];
    
    MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
    
    
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(playbackFinishedCallback:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:[movie moviePlayer]];
    
    [self presentMoviePlayerViewControllerAnimated:movie];
    movie.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
    [movie.moviePlayer play];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-08
      • 2011-05-29
      相关资源
      最近更新 更多