开发者

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

开发者 https://www.devze.com 2023-03-16 04:33 出处:网络
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

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

-(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); 
 开发者_StackOverflow社区   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];
0

精彩评论

暂无评论...
验证码 换一张
取 消