diff options
-rw-r--r-- | client/src/standalone/player/package.json | 2 | ||||
-rw-r--r-- | client/src/standalone/videos/embed-api.ts | 7 | ||||
-rw-r--r-- | support/doc/api/embeds.md | 3 |
3 files changed, 9 insertions, 3 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()) { |
diff --git a/support/doc/api/embeds.md b/support/doc/api/embeds.md index b1791ea13..a4236c521 100644 --- a/support/doc/api/embeds.md +++ b/support/doc/api/embeds.md | |||
@@ -123,7 +123,8 @@ Fired every half second to provide the current status of playback. The parameter | |||
123 | } | 123 | } |
124 | ``` | 124 | ``` |
125 | 125 | ||
126 | The `volume` field contains the volume from `0` (silent) to `1` (full volume). The `playbackState` can be `playing` or `paused`. More states may be added later. | 126 | The `volume` field contains the volume from `0` (silent) to `1` (full volume). |
127 | The `playbackState` can be `unstarted`, `playing`, `paused` or `ended`. More states may be added later. | ||
127 | 128 | ||
128 | ## Event `playbackStatusChange` | 129 | ## Event `playbackStatusChange` |
129 | 130 | ||