 class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
     @IBOutlet weak var livePhotoView: PHLivePhotoView! {
         didSet {
-            if let url = NSBundle.mainBundle().URLForResource("video", withExtension: "m4v") {
-                loadVideoWithVideoURL(url)
-            }
+            loadVideoWithVideoURL(NSBundle.mainBundle().URLForResource("video", withExtension: "m4v")!)
         }
     }
 

    }

    func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
        picker.dismissViewControllerAnimated(true) { [weak self] in
            if let url = info[UIImagePickerControllerMediaURL] as? NSURL {
                self?.loadVideoWithVideoURL(url)
            }
        }
    }

        }
    }

    func livePhotoWithImageURL(imageURL: NSURL, videoURL: NSURL) -> PHLivePhoto {
        let livePhoto = PHLivePhoto()
        let initWithImageURLvideoURL = Selector("_initWithImageURL:videoURL:")
        livePhoto.performSelector(initWithImageURLvideoURL, withObject:imageURL, withObject: videoURL)
        return livePhoto
    }

    @IBAction func takePhoto(sender: UIBarButtonItem) {
