{
"name": "@peertube/embed-api",
"private": false,
- "version": "0.0.1",
+ "version": "0.0.3",
"description": "API to communicate with the PeerTube player embed",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
private setupStateTracking () {
- let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted'
+ let currentState: 'playing' | 'paused' | 'unstarted' | 'ended' = 'unstarted'
setInterval(() => {
const position = this.element.currentTime
this.channel.notify({ method: 'playbackStatusChange', params: 'paused' })
})
+ this.element.addEventListener('ended', ev => {
+ currentState = 'ended'
+ this.channel.notify({ method: 'playbackStatusChange', params: 'ended' })
+ })
+
// PeerTube specific capabilities
if (this.isWebtorrent()) {
}
```
-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.
+The `volume` field contains the volume from `0` (silent) to `1` (full volume).
+The `playbackState` can be `unstarted`, `playing`, `paused` or `ended`. More states may be added later.
## Event `playbackStatusChange`