imagePicker property settings
func imagePicker(source:UIImagePickerControllerSourceType) -> UIImagePickerController { let picker = UIImagePickerController() picker.sourceType = source; picker.mediaTypes = [kUTTypeMovie as String] picker.allowsEditing = true; picker.delegate = self; return picker }
func imagePicker(source:UIImagePickerControllerSourceType) -> UIImagePickerController { let picker = UIImagePickerController() picker.sourceType = source; picker.mediaTypes = [kUTTypeMovie as String] picker.allowsEditing = true; picker.delegate = self; return picker } func convertVideToGIF(videoURL: NSURL, start: NSNumber?, duration: NSNumber?){ dispatch_async(dispatch_get_main_queue()){ self.dismissViewControllerAnimated(true, completion: nil) } let regift: Regift; if let start = start { regift = Regift(sourceFileURL: videoURL, destinationFileURL: nil, startTime: start.floatValue, duration: duration!.floatValue, frameRate: frameRate, loopCount: loopCount) } else { // Untrimmed regift = Regift(sourceFileURL: videoURL, destinationFileURL: nil, frameCount: frameCount, delayTime: delayTime, loopCount: loopCount) } let gifURL = regif.createGif() let gif = Gif(url: gifURL!, rawVideoURL: videoURL, caption: nil) displayGIF(gif) } public func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]){ let mediaType = info[UIImagePickerControllerMediaType] as! String if mediaType == kUTTypeMovie as String { let videoURL = info[UIImagePickerControllerMediaURL] as! NSURL let start: NSNumber? = info["_UIImagePickerControllerVideoEditingStart"] as? NSNumber let end: NSNumber? = info["_UIImagePickerControllerVideoEditingEnd"] as? NSNumber var duration: NSNumber? if let start = start { duration = NSNumber(float: (end!.floatValue) - (start.floatValue)) } else { duration = nil } convertVideoToGIF(videoURL, start: start, duration: duration) } }