Post

Replies

Boosts

Views

Activity

Playing slow motion videos from camera make it loses slow motion effect
So, I've never faced a problem like this for so long. I have basically scrutinized every possible website on the internet looking for a solution but have found nothing so far.I have a custom picker controller in which I can select videos and play them. Beforehand, I was struggling to play slow motion videos (only no-slow-motion videos were playing) but after searching I found the solution here.http://stackoverflow.com/questions/26152396/how-to-access-nsdata-nsurl-of-slow-motion-videos-using-photokitSo, my code to get videos became this:let videoOptions = PHVideoRequestOptions() videoOptions.version = PHVideoRequestOptionsVersion.Original PHImageManager.defaultManager().requestAVAssetForVideo(asset!, options: videoOptions , resultHandler: { (asset, audioMix, info) -> Void in if let asset = asset as? AVURLAsset { let videoData = NSData(contentsOfURL: asset.URL) let videoPath = NSTemporaryDirectory() + "tmpMovie.MOV" let videoURL = NSURL(fileURLWithPath: videoPath) let writeResult = videoData?.writeToURL(videoURL, atomically: true) if let writeResult = writeResult where writeResult { print("success") let videoVC = VideoViewController(videoUrl: videoURL) imagePicker.presentViewController(videoVC, animated: false, completion: nil) } else { print("failure") } } }) Now, slow motion videos are playing but in a normal way instead of in a slow-motion way. This questions relates to the problem.https://devforums.apple.com/message/903937#903937I've seen a lot of comments saying they solved the problem by using Photos framework, but I have no idea how to achieve this and they didn't explain either. It might be something to do PHAssetMediaSubtypeVideoHighFrameRate. So, how would be possible to play slow motion videos? Do I need to change the fps somehow?Please help, I am quite desperate :/ Objective-C code is welcome as well.
4
0
2.1k
Mar ’16