             switch (event.subtype) {
             case .RemoteControlPlay:
                 APIConnector.sharedInstance.sendCommand(.Pause)
+                player.play()
                 
             case .RemoteControlPause:
                 APIConnector.sharedInstance.sendCommand(.Pause)
+                player.pause()
+                
+            case .RemoteControlTogglePlayPause:
+                APIConnector.sharedInstance.sendCommand(.Pause)
+                if player.playing {
+                    player.pause()
+                }
+                else {
+                    player.play()
+                }
                 
             case .RemoteControlNextTrack:
                 APIConnector.sharedInstance.sendCommand(.Forward30Seconds)
                 
             case .RemoteControlPreviousTrack:
                 APIConnector.sharedInstance.sendCommand(.Backward30Seconds)
-                
+
             default:
                 break;
             }

    
    var detailItem: AnyObject? {
        didSet {
            self.configureView()
        }
    }
    
    func configureView() {
        if let detail: AnyObject = self.detailItem {
            self.navigationItem.title = detail.description
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.configureView()
        UIApplication.sharedApplication().beginReceivingRemoteControlEvents()
        self.becomeFirstResponder()

        // Configure audio session
        let sess = AVAudioSession.sharedInstance()
        sess.setCategory(AVAudioSessionCategoryPlayback, withOptions: nil, error: nil)
        sess.setActive(true, withOptions: nil, error: nil)
        

    
    var currentMovieName = ""
    var player : AVAudioPlayer!
    var currentVolume : Float = 0.5

    // MARK: - IBAction methods
    
