簡體   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