//
//  ViewController.swift
//  PlayVideo
//
//  Created by Keith Welch on 11/22/15.
//  Copyright © 2015 Keith Welch. All rights reserved.
//

import UIKit
import AVKit
import AVFoundation

class ViewController: UIViewController {

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

    @IBAction func btnPlayVideoTouched(sender: AnyObject) {
        playVideo()
    }
    
    private func playVideo() {
        let path = NSBundle.mainBundle().pathForResource("Moose", ofType:"mp4")
        let player = AVPlayer(URL: NSURL(fileURLWithPath: path!))
        let playerController = AVPlayerViewController()
        playerController.player = player
        self.presentViewController(playerController, animated: true) {
            player.play()
        }
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

