 //
 
 import UIKit
-import MediaPlayer
 import Photos
+import AVKit
 
 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!.URL)
			})
		}
    }

		self.presentViewController(pickerController, animated: true) {}
	}
	
    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
