Fix embed with api enabled

Don't off all handlers if the second argument is `undefined`
pull/6548/head
Chocobozzz 2024-05-30 16:28:32 +02:00 committed by Chocobozzz
parent 121a617bec
commit 103505421f
1 changed files with 3 additions and 3 deletions

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