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:
parent
b1f3b635ed
commit
96aae68cc4
3 changed files with 9 additions and 3 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue