Ensure we use the correct player video el

pull/6548/head
Chocobozzz 2024-05-30 16:28:20 +02:00 committed by Chocobozzz
parent 4a67994775
commit 121a617bec
1 changed files with 5 additions and 6 deletions

View File

@ -434,15 +434,14 @@ export class PeerTubeEmbed {
}
getImageDataUrl (): string {
const video = this.playerHTML.getInitVideoEl()
const canvas = document.createElement('canvas')
canvas.width = video.videoWidth
canvas.height = video.videoHeight
canvas.width = this.player.videoWidth()
canvas.height = this.player.videoHeight()
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height)
const videoEl = this.player.tech(true).el() as HTMLVideoElement
canvas.getContext('2d').drawImage(videoEl, 0, 0, canvas.width, canvas.height)
return canvas.toDataURL('image/jpeg')
}