{
"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"
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
}
})
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)
## Event `playbackStatusUpdate`
-Fired every half second to provide the current status of playback. The parameter of the callback will resemble:
+Fired every half second to provide the current status of playback.
+The parameter of the callback will resemble:
```json
{
"position": 22.3,
"volume": 0.9,
+ "duration": "171.37499",
"playbackState": "playing"
}
```