Merge branch 'release/4.3.0' into develop

This commit is contained in:
Chocobozzz 2022-10-24 10:44:25 +02:00
commit 91a4893063
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 16 additions and 2 deletions

View File

@ -259,6 +259,7 @@ export class PeerTubeEmbed {
if (this.player) {
this.player.dispose()
this.player = undefined
alreadyHadPlayer = true
}

View File

@ -6,6 +6,8 @@ import { Translations } from './translations'
export class LiveManager {
private liveSocket: Socket
private listeners = new Map<string, (payload: LiveVideoEventPayload) => void>()
constructor (
private readonly playerHTML: PlayerHTML
) {
@ -26,18 +28,26 @@ export class LiveManager {
this.liveSocket = io(window.location.origin + '/live-videos')
}
this.liveSocket.on('state-change', (payload: LiveVideoEventPayload) => {
const listener = (payload: LiveVideoEventPayload) => {
if (payload.state === VideoState.PUBLISHED) {
this.playerHTML.removeInformation()
onPublishedVideo()
return
}
})
}
this.liveSocket.on('state-change', listener)
this.listeners.set(video.uuid, listener)
this.liveSocket.emit('subscribe', { videoId: video.id })
}
stopListeningForChanges (video: VideoDetails) {
const listener = this.listeners.get(video.uuid)
if (listener) {
this.liveSocket.off('state-change', listener)
}
this.liveSocket.emit('unsubscribe', { videoId: video.id })
}

View File

@ -79,7 +79,10 @@ export class PlayerHTML {
}
removeInformation () {
if (!this.informationElement) return
this.removeElement(this.informationElement)
this.informationElement = undefined
}
private getPlaceholderElement () {