From 539dd6888dba9b95142ef4d5d4f129a5c5d27353 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Jul 2024 15:43:35 +0200 Subject: [PATCH] Correctly catch play promise --- client/src/standalone/videos/embed-api.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/src/standalone/videos/embed-api.ts b/client/src/standalone/videos/embed-api.ts index f7a46ddae..9392765b4 100644 --- a/client/src/standalone/videos/embed-api.ts +++ b/client/src/standalone/videos/embed-api.ts @@ -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))