//
//  ViewController.swift
//  WatchMediaPlayback
//
//  Created by Jeff Kelley on 3/30/15.
//  Copyright (c) 2015 Pragmatic Bookshelf. All rights reserved.
//

import UIKit
import MediaPlayer

class ViewController: UIViewController {
    
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)

        let infoCenter = MPNowPlayingInfoCenter.defaultCenter()
        
        infoCenter!.nowPlayingInfo = [MPMediaItemPropertyArtist: "Rick Astley",
            MPMediaItemPropertyTitle: "Never Gonna Give You Up",
            MPMediaItemPropertyPlaybackDuration: 211.0,
            MPMediaItemPropertyAlbumTitle: "Rick Astley: The Greatest Hits",
            MPMediaItemPropertyAlbumTrackCount: 17,
            MPMediaItemPropertyAlbumTrackNumber: 0,
            MPMediaItemPropertyGenre: "Pop",
        ]
        
        let commandCenter = MPRemoteCommandCenter.sharedCommandCenter()
        
        if let playCommand = commandCenter.playCommand {
            playCommand.addTargetWithHandler { (event: MPRemoteCommandEvent!) in 
                self.play()
                return MPRemoteCommandHandlerStatus.Success
            }
        }
    }
    
    private func play() {
        // Play code here
    }

}
