 		self.presentViewController(pickerController, animated: true) {}
 	}
 	
-    func playVideo(videoURL: NSURL) {
-        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ViewController.exitPlayer(_:)), name: MPMoviePlayerPlaybackDidFinishNotification, object: nil)
-        
-        let player = MPMoviePlayerController(contentURL: videoURL)
-        player.movieSourceType = .File
-        player.controlStyle = .Fullscreen
-        player.fullscreen = true
-        
-        player.view.frame = view.bounds
-        view.addSubview(player.view)
-        
-        player.prepareToPlay()
-        player.play()
-        
-        self.player = player
-    }
-    
-    func exitPlayer(notification: NSNotification) {
-        let reason = (notification.userInfo!)[MPMoviePlayerPlaybackDidFinishReasonUserInfoKey] as! NSNumber!
-        if reason.integerValue == MPMovieFinishReason.UserExited.rawValue {
-            NSNotificationCenter.defaultCenter().removeObserver(self)
-            self.player?.view.removeFromSuperview()
-            self.player = nil
-        }
+    func playVideo(asset: AVAsset) {
+		let avPlayerItem = AVPlayerItem(asset: asset)
+		
+		let avPlayer = AVPlayer(playerItem: avPlayerItem)
+		let player = AVPlayerViewController()
+		player.player = avPlayer
+		
+        avPlayer.play()
+		
+		self.presentViewController(player, animated: true, completion: nil)
     }
     
     // MARK: - UITableViewDataSource, UITableViewDelegate methods

//

import UIKit
import MediaPlayer
import Photos

class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate {
    var player: MPMoviePlayerController?
    
    @IBOutlet var previewView: UICollectionView?
    var assets: [DKAsset]?
    

        let asset = self.assets![indexPath.row]
		asset.fetchAVAssetWithCompleteBlock { (avAsset, info) in
			dispatch_async(dispatch_get_main_queue(), { () in
				self.playVideo(avAsset!)
			})
		}
    }
