mobileplayer-iosという動画再生ライブラリを試してみました。
動画ファイルを用意するだけで動画の再生ボタンやシークバー付きで動画再生ができます。
インストール方法
例の如くCocoaPodsを使います。
pod "MobilePlayer"
使い方
MobilePlayerViewControllerに動画URLを渡すだけで完了です。
動画タイトルもセットする事ができます。
import MobilePlayer class MasterViewController: UITableViewController { override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) let url = NSBundle(forClass: self.dynamicType).URLForResource("sample", withExtension: "mov")! let playerVC = MobilePlayerViewController(contentURL: url) playerVC.title = "タイトル" playerVC.activityItems = [url] // Check the documentation for more information. presentViewController(playerVC, animated: true, completion: nil) } }
サンプルを見たところ、Youtubeの広告のようなオーバーレイを表示したり停止中に画面上に好きなビューを表示したりとかなり多くの機能を持っていそうでした。