私はiPhoneとObjective-cを初めて使用します。私のアプリを使用しているユーザーに、サッカーの試合を想定したライブの試合を見せたいと思います。iPhoneアプリでのライブビデオストリーミングには何が必要ですか?
これに関する情報は大歓迎です!
ありがとう
みんな、誰かがこれを前にやったに違いないのを手伝ってください?
私はiPhoneとObjective-cを初めて使用します。私のアプリを使用しているユーザーに、サッカーの試合を想定したライブの試合を見せたいと思います。iPhoneアプリでのライブビデオストリーミングには何が必要ですか?
これに関する情報は大歓迎です!
ありがとう
みんな、誰かがこれを前にやったに違いないのを手伝ってください?
動画ファイルの URL を指定するだけで、ストリームは接続速度に応じて自動的に設定されます。
解像度が iPhone の制限内にあるビデオのみが再生されることに注意してください。高解像度のムービーは Simulator で再生できますが、iPhone では動作しません。
のオブジェクトが必要でMPMoviePlayerController、残りのコードは次のようになります。
-(void) play {
NSURL *movieURL = [NSURL URLWithString:@"http://movies.apple.com/media/us/mac/getamac/2009/apple-mvp-biohazard_suit-us-20090419_480x272.mov"];
if (movieURL != nil) {
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
moviePlayer.initialPlaybackTime = -1.0;
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerScalingModeDidChangeNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(endPlay:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
moviePlayer.movieControlMode = MPMovieControlModeDefault;
moviePlayer.backgroundColor = [UIColor blackColor];
[moviePlayer play];
}
}
-(void)moviePlayBackDidFinish: (NSNotification*)notification
{
self.navigationItem.hidesBackButton = FALSE;
moviePlayer = [notification object];
[moviePlayer play];
}
-(void)endPlay: (NSNotification*)notification
{
NSLog(@"end Playing");
self.navigationItem.hidesBackButton = FALSE;
//[[UIApplication sharedApplication] endIgnoringInteractionEvents];
[actview stopAnimating];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerScalingModeDidChangeNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[moviePlayer stop];
[moviePlayer release];
}
問題のサッカーの試合のビデオの権利を持っていると仮定すると、ライブビデオをオンザフライで適切な形式 (mp4、h263 など) にエンコードするエンコーダが必要です。これらを再生する iPhone の方法は、ライブ ビデオのチャンクを調べて再生する動的なプレイリストを用意することです。
ライブ ストリーミングについて説明しているドキュメントへの参照を次に示します。参考になるかもしれません。