MPMoviePlayerController の URL からライブ ストリーム ビデオを再生したい。UIWebView で動画を再生するリンクを取得しました。UIWebView は、MPMoviePlayerController を起動すると、出力を NSLog として提供します。そして、問題なくストリームを再生します!
setting movie path:
http://ibbtks.noc.com.tr/ibbesm/bagdat2lq.stream/playlist.m3u8?k=ffd81df8cfee8f9259eff91dc9a483c4
その動画の URL を NSLog から取得し、MPMoviePlayerController に入れました。それは私が使用したコードです、
- (void)playMovie
{
NSURL* myUrl = [NSURL URLWithString:@"http://ibbtks.noc.com.tr/ibbesm/kadikoylq.stream/playlist.m3u8"];
NSURL* appleUrl = [NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8"];
_moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:myUrl];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:_moviePlayer];
_moviePlayer.controlStyle = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
_moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self.view addSubview:_moviePlayer.view];
[_moviePlayer setFullscreen:YES animated:YES];
}
問題なくappleUrlストリームを再生しますが、myUrlを再生しようとすると、常にロードされ、エラーが発生します。エラー出力は、
Did finish with error: Error Domain=MediaPlayerErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x99a9760 {NSLocalizedDescription=The operation could not be completed}
このリンクを UIWebView または safari で再生しようとすると、ビデオが正常に再生され、先ほど言ったように、使用した NSLog として URL が返されます。しかし、この URL を自分で再生しようとすると、エラーが発生しました。助言がありますか?
前もって感謝します。