diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-08 14:39:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-04-08 14:39:31 +0200 |
commit | 96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da (patch) | |
tree | d14363cd209f507d6ada3d53b8093c83ae12437b /client/src/standalone/videos | |
parent | b1f3b635edf48949d268ce3d72fc33f126932a21 (diff) | |
download | PeerTube-96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da.tar.gz PeerTube-96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da.tar.zst PeerTube-96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da.zip |
Add "ended" embed API event
Diffstat (limited to 'client/src/standalone/videos')
-rw-r--r-- | client/src/standalone/videos/embed-api.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/client/src/standalone/videos/embed-api.ts b/client/src/standalone/videos/embed-api.ts index 61e5d0b9a..c5fbe07fa 100644 --- a/client/src/standalone/videos/embed-api.ts +++ b/client/src/standalone/videos/embed-api.ts | |||
@@ -80,7 +80,7 @@ export class PeerTubeEmbedApi { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | private setupStateTracking () { | 82 | private setupStateTracking () { |
83 | let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted' | 83 | let currentState: 'playing' | 'paused' | 'unstarted' | 'ended' = 'unstarted' |
84 | 84 | ||
85 | setInterval(() => { | 85 | setInterval(() => { |
86 | const position = this.element.currentTime | 86 | const position = this.element.currentTime |
@@ -106,6 +106,11 @@ export class PeerTubeEmbedApi { | |||
106 | this.channel.notify({ method: 'playbackStatusChange', params: 'paused' }) | 106 | this.channel.notify({ method: 'playbackStatusChange', params: 'paused' }) |
107 | }) | 107 | }) |
108 | 108 | ||
109 | this.element.addEventListener('ended', ev => { | ||
110 | currentState = 'ended' | ||
111 | this.channel.notify({ method: 'playbackStatusChange', params: 'ended' }) | ||
112 | }) | ||
113 | |||
109 | // PeerTube specific capabilities | 114 | // PeerTube specific capabilities |
110 | 115 | ||
111 | if (this.isWebtorrent()) { | 116 | if (this.isWebtorrent()) { |