1
0
Fork 0
forked from lesion/plaid

arrow function FTW

This commit is contained in:
boyska 2023-09-08 05:11:20 -05:00
parent 5378de3cbb
commit 40aa65611e

View file

@ -39,18 +39,17 @@ export default {
eventBus.$off('play:now')
},
mounted () {
const t = this
eventBus.$on('play:now', function (url, metadata) {
t.play(url, metadata)
eventBus.$on('play:now', (url, metadata) => {
this.play(url, metadata)
})
eventBus.$on('play:pause', function() {
if(t.player) {
t.player.pause()
eventBus.$on('play:pause', () => {
if(this.player) {
this.player.pause()
}
})
eventBus.$on('play:resume', function() {
if(t.player) {
t.player.play()
})
eventBus.$on('play:resume', () => {
if(this.player) {
this.player.play()
}
})
},
@ -72,22 +71,21 @@ export default {
preload: true,
src: Array.isArray(url) ? url : [url],
})
const t = this
for(const eventName of ['pause', 'play', 'end']) {
newPlayer.on(eventName, this.updateStatusFromPlayer)
}
newPlayer.once('play', function setProperData() {
if(t.player) {
t.player.stop()
t.player.unload()
newPlayer.once('play', () => {
if(this.player) {
this.player.stop()
this.player.unload()
}
t.player = newPlayer
this.player = newPlayer
if(metadata !== undefined) {
t.title = metadata.title
t.live = metadata.live
this.title = metadata.title
this.live = metadata.live
}
t.loading = false
t.updateStatusFromPlayer()
this.loading = false
this.updateStatusFromPlayer()
})
newPlayer.play()