         }
     }
 
-    override func didReceiveMemoryWarning() {
-        super.didReceiveMemoryWarning()
-        // Dispose of any resources that can be recreated.
-    }
-
-
+    // MARK: - Utility Methods
+    
     func playVideoWithYoutubeURL(url: NSURL) {
         let playerItem = AVPlayerItem.init(URL: url)
         let player = AVPlayer(playerItem: playerItem)
         
-        self.moviePlayer.player = player
-
+        self.avPlayer.player = player
         
         Youtube.h264videosWithYoutubeURL(url, completion: { (videoInfo, error) -> Void in
             if let videoURLString = videoInfo?["url"] as? String where ((videoInfo?["title"] as? String) != nil) {


class DetailViewController: UIViewController {

    @IBOutlet weak var playButton: UIButton!
    @IBOutlet weak var detailDescriptionLabel: UILabel!

    let moviePlayer = AVPlayerViewController()


    var detailItem: AnyObject? {
        didSet {

        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        self.configureView()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    // MARK: - Actions
    
    @IBAction func tappedPlayButton(sender: AnyObject) {
        avPlayer.view.frame = view.frame
        self.presentViewController(avPlayer, animated: true) { () -> Void in
            //
        }
        
        
        //        let youtubeURL = NSURL(string: "https://www.youtube.com/watch?v=swZJwZeMesk")!
        if let videoInfo = self.detailItem {
            if let videoURLString = videoInfo["url"] as? String {
                let youtubeURL = NSURL(string: videoURLString)!
