繁体   English   中英

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

[英]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 应用程序中使用的代码段,用于播放来自服务器的流式视频。 但它没有播放视频

-(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];

}
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];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM