From 6ccdf9d53e4d68bcdf49bb7098c382d059988c4e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 8 Apr 2020 14:51:44 +0200 Subject: Add duration in embed api playbackStatusUpdate --- client/src/standalone/player/package.json | 2 +- client/src/standalone/videos/embed-api.ts | 2 ++ client/src/standalone/videos/test-embed.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'client/src') 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 @@ { "name": "@peertube/embed-api", "private": false, - "version": "0.0.3", + "version": "0.0.4", "description": "API to communicate with the PeerTube player embed", "scripts": { "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 { setInterval(() => { const position = this.element.currentTime const volume = this.element.volume + const duration = this.element.duration this.channel.notify({ method: 'playbackStatusUpdate', params: { position, volume, + duration: this.embed.player.duration(), playbackState: currentState } }) 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 () => { const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[ 0 ] const iframe = document.createElement('iframe') - iframe.src = `/videos/embed/${videoId}?autoplay=1&controls=0&api=1` + iframe.src = `/videos/embed/${videoId}?api=1` const mainElement = document.querySelector('#host') mainElement.appendChild(iframe) -- cgit v1.2.3