aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-08 14:39:31 +0200
committerChocobozzz <me@florianbigard.com>2020-04-08 14:39:31 +0200
commit96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da (patch)
treed14363cd209f507d6ada3d53b8093c83ae12437b /client/src
parentb1f3b635edf48949d268ce3d72fc33f126932a21 (diff)
downloadPeerTube-96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da.tar.gz
PeerTube-96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da.tar.zst
PeerTube-96aae68cc47b7ac9b9400d5b5cf95acdf9fe38da.zip
Add "ended" embed API event
Diffstat (limited to 'client/src')
-rw-r--r--client/src/standalone/player/package.json2
-rw-r--r--client/src/standalone/videos/embed-api.ts7
2 files changed, 7 insertions, 2 deletions
diff --git a/client/src/standalone/player/package.json b/client/src/standalone/player/package.json
index 591c3ee3d..ba36b8ad3 100644
--- a/client/src/standalone/player/package.json
+++ b/client/src/standalone/player/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "name": "@peertube/embed-api", 2 "name": "@peertube/embed-api",
3 "private": false, 3 "private": false,
4 "version": "0.0.1", 4 "version": "0.0.3",
5 "description": "API to communicate with the PeerTube player embed", 5 "description": "API to communicate with the PeerTube player embed",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1" 7 "test": "echo \"Error: no test specified\" && exit 1"
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()) {