diff options
-rw-r--r-- | client/src/standalone/player/package.json | 2 | ||||
-rw-r--r-- | client/src/standalone/videos/embed-api.ts | 2 | ||||
-rw-r--r-- | client/src/standalone/videos/test-embed.ts | 2 | ||||
-rw-r--r-- | support/doc/api/embeds.md | 4 |
4 files changed, 7 insertions, 3 deletions
diff --git a/client/src/standalone/player/package.json b/client/src/standalone/player/package.json index ba36b8ad3..985097af5 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.3", | 4 | "version": "0.0.4", |
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 c5fbe07fa..194465d4a 100644 --- a/client/src/standalone/videos/embed-api.ts +++ b/client/src/standalone/videos/embed-api.ts | |||
@@ -85,12 +85,14 @@ export class PeerTubeEmbedApi { | |||
85 | setInterval(() => { | 85 | setInterval(() => { |
86 | const position = this.element.currentTime | 86 | const position = this.element.currentTime |
87 | const volume = this.element.volume | 87 | const volume = this.element.volume |
88 | const duration = this.element.duration | ||
88 | 89 | ||
89 | this.channel.notify({ | 90 | this.channel.notify({ |
90 | method: 'playbackStatusUpdate', | 91 | method: 'playbackStatusUpdate', |
91 | params: { | 92 | params: { |
92 | position, | 93 | position, |
93 | volume, | 94 | volume, |
95 | duration: this.embed.player.duration(), | ||
94 | playbackState: currentState | 96 | playbackState: currentState |
95 | } | 97 | } |
96 | }) | 98 | }) |
diff --git a/client/src/standalone/videos/test-embed.ts b/client/src/standalone/videos/test-embed.ts index 202e86667..a4b54782c 100644 --- a/client/src/standalone/videos/test-embed.ts +++ b/client/src/standalone/videos/test-embed.ts | |||
@@ -8,7 +8,7 @@ window.addEventListener('load', async () => { | |||
8 | const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ] | 8 | const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ] |
9 | 9 | ||
10 | const iframe = document.createElement('iframe') | 10 | const iframe = document.createElement('iframe') |
11 | iframe.src = `/videos/embed/${videoId}?autoplay=1&controls=0&api=1` | 11 | iframe.src = `/videos/embed/${videoId}?api=1` |
12 | 12 | ||
13 | const mainElement = document.querySelector('#host') | 13 | const mainElement = document.querySelector('#host') |
14 | mainElement.appendChild(iframe) | 14 | mainElement.appendChild(iframe) |
diff --git a/support/doc/api/embeds.md b/support/doc/api/embeds.md index 80e03b487..80d6c2279 100644 --- a/support/doc/api/embeds.md +++ b/support/doc/api/embeds.md | |||
@@ -113,12 +113,14 @@ You can subscribe to events by using `addEventListener()`. See above for details | |||
113 | 113 | ||
114 | ## Event `playbackStatusUpdate` | 114 | ## Event `playbackStatusUpdate` |
115 | 115 | ||
116 | Fired every half second to provide the current status of playback. The parameter of the callback will resemble: | 116 | Fired every half second to provide the current status of playback. |
117 | The parameter of the callback will resemble: | ||
117 | 118 | ||
118 | ```json | 119 | ```json |
119 | { | 120 | { |
120 | "position": 22.3, | 121 | "position": 22.3, |
121 | "volume": 0.9, | 122 | "volume": 0.9, |
123 | "duration": "171.37499", | ||
122 | "playbackState": "playing" | 124 | "playbackState": "playing" |
123 | } | 125 | } |
124 | ``` | 126 | ``` |