Trigger checkAspectRatio on loadedmetadata event (#3147)

This commit is contained in:
absidue 2023-02-05 19:40:25 +01:00 committed by GitHub
parent a6bb002e97
commit c3867259e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 8 deletions

View File

@ -492,7 +492,6 @@ export default defineComponent({
this.player.on('ready', () => {
this.$emit('ready')
this.checkAspectRatio()
this.createStatsModal()
if (this.captionHybridList.length !== 0) {
this.transformAndInsertCaptions()
@ -500,6 +499,10 @@ export default defineComponent({
this.toggleScreenshotButton()
})
this.player.one('loadedmetadata', () => {
this.checkAspectRatio()
})
this.player.on('ended', () => {
this.$emit('ended')
@ -674,13 +677,6 @@ export default defineComponent({
const videoWidth = this.player.videoWidth()
const videoHeight = this.player.videoHeight()
if (videoWidth === 0 || videoHeight === 0) {
setTimeout(() => {
this.checkAspectRatio()
}, 200)
return
}
if ((videoWidth - videoHeight) <= 240) {
this.player.fluid(false)
this.player.aspectRatio('16:9')