X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=client%2Fsrc%2Fassets%2Fplayer%2Fpeertube-plugin.ts;h=dd9408c8e280b37df8803cc3b9d96ddb36af24ef;hb=432ebe8bddb407bfbe503b782d59b1ee4c0d6842;hp=3991e462712455c8699c67078b5173993d6cc46d;hpb=f0a3988066f72a28bb44520af072f18d91d77dde;p=oweals%2Fpeertube.git diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/peertube-plugin.ts index 3991e4627..dd9408c8e 100644 --- a/client/src/assets/player/peertube-plugin.ts +++ b/client/src/assets/player/peertube-plugin.ts @@ -83,9 +83,15 @@ class PeerTubePlugin extends Plugin { if (options.stopTime) { const stopTime = timeToInt(options.stopTime) + const self = this - this.player.on('timeupdate', () => { - if (this.player.currentTime() > stopTime) this.player.pause() + this.player.on('timeupdate', function onTimeUpdate () { + if (self.player.currentTime() > stopTime) { + self.player.pause() + self.player.trigger('stopped') + + self.player.off('timeupdate', onTimeUpdate) + } }) }