     func pause(notify: Bool) {
         player?.pause()
         shouldAutoplay = false
+
         if notify {
             NSNotificationCenter.defaultCenter().postNotificationName(PlayerDidChangeStateNotification, object: self)
         }

        
        if (shouldAutoplay) {
            player?.play()
        }
    }
    

    }
    
    private var shouldAutoplay = false
    private var shouldNotify = false
    func play(notify: Bool) {
        prepareToPlay()
        finishedPlaying = false
        if (player == nil) {
            shouldAutoplay = true
            shouldNotify = notify
        } else {
            player?.play()
            if notify {
                NSNotificationCenter.defaultCenter().postNotificationName(PlayerDidChangeStateNotification, object: self)
            }
        }
    }
    
