Fix embed with api enabled

Don't off all handlers if the second argument is `undefined`
This commit is contained in:
Chocobozzz 2024-05-30 16:28:32 +02:00 committed by Chocobozzz
parent 121a617bec
commit 103505421f

View File

@ -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)
}