Correctly catch play promise

pull/6527/head
Chocobozzz 2024-07-12 15:43:35 +02:00
parent 6379d42d64
commit 539dd6888d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 9 additions and 1 deletions

View File

@ -44,7 +44,15 @@ export class PeerTubeEmbedApi {
channel.bind('setVideoPassword', (txn, value) => this.embed.setVideoPasswordByAPI(value))
channel.bind('play', (txn, params) => this.player.play())
channel.bind('play', (txn, params) => {
const p = this.player.play()
if (p) return
p.catch((err: Error) => {
console.error('Cannot play the video', err)
})
})
channel.bind('pause', (txn, params) => this.player.pause())
channel.bind('seek', (txn, time) => this.player.currentTime(time))