diff --git a/src/renderer/components/ft-video-player/ft-video-player.js b/src/renderer/components/ft-video-player/ft-video-player.js index 5d220ed1..98b76249 100644 --- a/src/renderer/components/ft-video-player/ft-video-player.js +++ b/src/renderer/components/ft-video-player/ft-video-player.js @@ -77,7 +77,7 @@ export default Vue.extend({ activeSourceList: [], mouseTimeout: null, dataSetup: { - aspectRatio: '16:9', + fluid: true, nativeTextTracks: false, plugins: {}, controlBar: { @@ -244,6 +244,7 @@ export default Vue.extend({ this.player.on('ready', function () { v.$emit('ready') + v.checkAspectRatio() }) this.player.on('ended', function () { @@ -272,6 +273,23 @@ export default Vue.extend({ } }, + checkAspectRatio() { + const videoWidth = this.player.videoWidth() + const videoHeight = this.player.videoHeight() + + if (videoWidth === 0 || videoHeight === 0) { + setTimeout(() => { + this.checkAspectRatio() + }, 200) + return + } + + if (videoWidth < videoHeight) { + this.player.fluid(false) + this.player.aspectRatio('16:9') + } + }, + updateVolume: function (event) { const volume = this.player.volume() sessionStorage.setItem('volume', volume)