【问题标题】:This is the code segment i am using in my iOS Application to play the Streaming Video from the Server . But its not playing the video这是我在我的 iOS 应用程序中用来播放来自服务器的流式视频的代码段。但它没有播放视频
【发布时间】:2011-06-30 08:30:14
【问题描述】:

这是我在 iOS 应用程序中用来播放来自服务器的流媒体视频的代码段。但它没有播放视频

-(IBAction)PlayTV:(id)sender{

    MPMoviePlayerController *player2 = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://87945.obj.myservmedia.net/quit1/mpegts.stream/playlist.m3u8"]];
    player2.movieSourceType = MPMovieSourceTypeStreaming;
    player2.view.frame = CGRectMake(25, 117, 270, 189); 
    player2.view.backgroundColor = [UIColor blackColor];
    player2.view.hidden = NO;
    [self.view addSubview:player2.view];
    [player2 play];

}

【问题讨论】:

  • 我试过这个,但是链接失效了。这就是它可能不起作用的原因。
  • 谁能给我一个工作播放列表,仅供测试
  • 看看网络 - 有很多流可供测试。
  • 我在谷歌上搜索过....但我没有找到任何人...你能指点我一个吗...

标签: iphone ios


【解决方案1】:
NSURL *mediaURL = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"];
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:mediaURL];
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlayBackDidFinish:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:mp]; 

[mp setControlStyle:MPMovieControlStyleFullscreen];
[mp setMovieSourceType:MPMovieSourceTypeStreaming];
[mp setFullscreen:YES];
mp.view.frame = self.view.bounds;
[self.view addSubview:[mp view]];

[mp prepareToPlay];
[mp play];

【讨论】:

    猜你喜欢
    • 2016-06-12
    • 1970-01-01
    • 2018-09-11
    • 1970-01-01
    • 1970-01-01
    • 2019-12-05
    • 1970-01-01
    • 1970-01-01
    • 2014-09-23
    相关资源
    最近更新 更多