【问题标题】:iPhone:video url is not playin using MPMoviePlayeriPhone:视频网址未使用 MP 电影播放器​​播放
【发布时间】:2012-09-26 07:55:18
【问题描述】:

我提供了一个播放视频文件的网址,我使用以下代码播放视频

NSURL *url = [NSURL URLWithString:@"http://www.hddeo.com/video/more.html"];
    player = [[MPMoviePlayerController alloc] initWithContentURL:url];;

    [player setControlStyle:MPMovieControlStyleNone];
    player.view.frame = CGRectMake(110,375,540,250);
    // player.view.frame = CGRectMake(50, 375, 600, 415);
    [self.view addSubview:player.view];

在模拟器中视频无法播放 我不知道为什么会这样

如果你有任何想法请分享一下

提前谢谢...

【问题讨论】:

    标签: iphone objective-c mpmovieplayer


    【解决方案1】:

    您传递的内容 URL 是一个嵌入了 SWF 文件的 HTML 页面。 MPMoviePlayerController 需要一个直接指向视频文件的内容 URL,例如“http://www.example.com/video.mp4”。

    请注意,iOS 设备不支持 Adob​​e Flash 文件。

    【讨论】:

    • @iPhone 恐怕你做不到。
    【解决方案2】:
    //try this code   
    
      NSURL *url = [NSURL URLWithString:@"http://www.hddeo.com/video/more.html"];
            player = [[MPMoviePlayerController alloc] initWithContentURL:url];;
    
            [player setControlStyle:MPMovieControlStyleNone];
            player.view.frame = CGRectMake(110,375,540,250);
            // player.view.frame = CGRectMake(50, 375, 600, 415);
            [moviePlayer play];
            [self.view addSubview:player.view];
    
            //   [moviePlayer prepareToPlay];
             //   [moviePlayer play];
             //   [moviePlayer pause];     // it preform action play pause ,stop
             //   [moviePlayer stop];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-05
      • 1970-01-01
      • 2013-06-20
      相关资源
      最近更新 更多