From 103505421fef1c9a110511c5da6fe68de506365c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 May 2024 16:28:32 +0200 Subject: [PATCH] Fix embed with api enabled Don't off all handlers if the second argument is `undefined` --- client/src/standalone/videos/embed-api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/standalone/videos/embed-api.ts b/client/src/standalone/videos/embed-api.ts index cc7b178db..f7a46ddae 100644 --- a/client/src/standalone/videos/embed-api.ts +++ b/client/src/standalone/videos/embed-api.ts @@ -166,9 +166,9 @@ export class PeerTubeEmbedApi { private disposeStateTracking () { if (!this.player) return - this.player.off('play', this.videoElPlayListener) - this.player.off('pause', this.videoElPauseListener) - this.player.off('ended', this.videoElEndedListener) + if (this.videoElPlayListener) this.player.off('play', this.videoElPlayListener) + if (this.videoElPauseListener) this.player.off('pause', this.videoElPauseListener) + if (this.videoElEndedListener) this.player.off('ended', this.videoElEndedListener) clearInterval(this.videoElInterval) }