1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 09:49:20 +02:00

Add "ended" embed API event

This commit is contained in:
Chocobozzz 2020-04-08 14:39:31 +02:00
parent b1f3b635ed
commit 96aae68cc4
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 9 additions and 3 deletions

View file

@ -80,7 +80,7 @@ export class PeerTubeEmbedApi {
}
private setupStateTracking () {
let currentState: 'playing' | 'paused' | 'unstarted' = 'unstarted'
let currentState: 'playing' | 'paused' | 'unstarted' | 'ended' = 'unstarted'
setInterval(() => {
const position = this.element.currentTime
@ -106,6 +106,11 @@ export class PeerTubeEmbedApi {
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()) {