Created
October 31, 2014 02:55
-
-
Save seka/2d9d48ab567db52e531a to your computer and use it in GitHub Desktop.
AssetLibraryから動画を再生する際の設定 - Setup when playing a video from AssetLibrary (サンプル - Sample)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func setupAssetMovieContents() { | |
let file = NSURL(string: "assets-library:// ~ hogehuga ~ ") | |
let assetLibrary = ALAssetsLibrary() | |
assetLibrary.assetForURL( | |
file | |
, resultBlock: { | |
(asset: ALAsset!) in | |
if asset != nil { | |
let rep: ALAssetRepresentation = asset.defaultRepresentation() | |
var mvc = MPMoviePlayerViewController() | |
mvc.view.frame = CGRectMake(860, 0, 800, 350) | |
var vc = mvc.moviePlayer | |
vc.contentURL = rep.url() | |
vc.view.frame = CGRectMake(865, 10, 800, 330) | |
vc.scalingMode = MPMovieScalingMode.Fill | |
vc.shouldAutoplay = false | |
vc.setFullscreen(true, animated: true) | |
self.scrollViewOfProfile.addSubview(vc.view) | |
} | |
} | |
, failureBlock: { | |
(error: NSError!) in | |
println("Error!\(error)") | |
} | |
) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment