4

iPadで映画をストリーミングしています。mp4 ファイルをロードしただけでは、プレーヤーは自動起動しませんが、m3u8 の例では、自動起動を要求します。誰かがこれに遭遇しましたか?私は何か間違ったことをしていますか?

- (id)initWithVideo:(VideoDO*)video frame:(CGRect)rect { 
NSURL* videoURL = [NSURL     URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]; // With    this URL, player starts automatically
 self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];

 moviePlayer.shouldAutoplay = NO;
 moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
 moviePlayer.view.frame = rect;
 moviePlayer.view.backgroundColor = [UIColor blackColor]; 
 [moviePlayer prepareToPlay];  

 self.view = moviePlayer.view;   
 [moviePlayer stop];

 [[NSNotificationCenter defaultCenter] addObserver:self    selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieChangedLoadState:) name:MPMoviePlayerLoadStateDidChangeNotification object:moviePlayer];


 return self;
} 
4

1 に答える 1

0

ここで [moviePlayer の一時停止] を実行できます。[moviePlayer stop] の代わりに; 行を削除します [moviePlayer prepareToPlay]; コードから、それは動作します。問題があればお知らせください。

于 2011-06-20T18:12:02.833 に答える