iPad Techfirm Lab

One more thing…

      こんにちは!YuiChiLoです         

メディアプレーヤーの生成

By YuiChiLo

      

覚え書き。

メディアプレーヤーを作成して、動画を再生します。

MPMoviePlayerControllerを使用します。

#import <MediaPlayer/MediaPlayer.h>

した上で、

// 動画URL
NSString *movieURL = @"[URL]";
NSURL *url = [NSURL URLWithString:movieURL];
// プレーヤーを生成
MPMoviePlayerController	*player = [[MPMoviePlayerController alloc] init];
[player setContentURL:url];
// プレーヤーを再生
[player play];



これが再生までの流れです。


ネットワークを考慮した処理などが抜けているので実際には必要です。
Notificationsを利用して、データ取得後、再生後等の通知を設定します。


人気エントリー