Fix play/pause handling bug

This commit is contained in:
An Phan 2017-03-26 11:46:17 +08:00
parent cc43d5133a
commit 26e57bd643
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2

View file

@ -80,18 +80,8 @@ export const playback = {
event.emit('equalizer:init', this.player.media)
if ('mediaSession' in navigator) {
navigator.mediaSession.setActionHandler('play', () => {
if (queueStore.current) {
if (queueStore.current.playbackState === 'paused') {
this.resume()
} else {
this.pause()
}
}
})
navigator.mediaSession.setActionHandler('pause', () => {
this.pause()
})
navigator.mediaSession.setActionHandler('play', () => this.resume())
navigator.mediaSession.setActionHandler('pause', () => this.pause())
navigator.mediaSession.setActionHandler('previoustrack', () => {
navigator.mediaSession.playbackState = 'playing'
this.playPrev()