Use Fluid Mode for videos instead of setting an aspect ratio
This commit is contained in:
parent
9a75e6a53a
commit
dad0eb73ca
|
@ -77,7 +77,7 @@ export default Vue.extend({
|
||||||
activeSourceList: [],
|
activeSourceList: [],
|
||||||
mouseTimeout: null,
|
mouseTimeout: null,
|
||||||
dataSetup: {
|
dataSetup: {
|
||||||
aspectRatio: '16:9',
|
fluid: true,
|
||||||
nativeTextTracks: false,
|
nativeTextTracks: false,
|
||||||
plugins: {},
|
plugins: {},
|
||||||
controlBar: {
|
controlBar: {
|
||||||
|
@ -244,6 +244,7 @@ export default Vue.extend({
|
||||||
|
|
||||||
this.player.on('ready', function () {
|
this.player.on('ready', function () {
|
||||||
v.$emit('ready')
|
v.$emit('ready')
|
||||||
|
v.checkAspectRatio()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.player.on('ended', function () {
|
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) {
|
updateVolume: function (event) {
|
||||||
const volume = this.player.volume()
|
const volume = this.player.volume()
|
||||||
sessionStorage.setItem('volume', volume)
|
sessionStorage.setItem('volume', volume)
|
||||||
|
|
Loading…
Reference in New Issue