Im using the vue-vimeo-player in vue.js for embedding vimeo video. I want to stretch the video over the full width of the screen and make it responsive but I cannot make it to stretch.
Here is a simple component in vue illustrating the problem. I can of course change the player-height and player-width props to change the size but I cannot make it 100% and responsive. I thought the vimeo class in my css should solve this but no luck.
Any hint would be very much apreciated!
<template>
<vimeo-player
class="vimeo"
ref="player"
:video-id="videoID"
@ready="onReady"
:autoplay="true"
:player-height="320"
:player-width="640"
loop="1"
></vimeo-player>
</template>
<script>
export default {
data() {
return {
videoID: "224712377",
options: {},
playerReady: false
};
},
methods: {
onReady() {
this.playerReady = true;
},
play() {
this.$refs.player.play();
},
stop() {
this.$refs.player.stop();
}
}
};
</script>
<style lang="scss">
.vimeo {
left: 0;
top: 0;
height: 100%;
width: 100%;
// max-height: 200px;
position: absolute;
}
</style>
The vue component is just a wrapper for the vimeo player.
Upon further investigation,
the vue-vimeo-player
is requiring the vimeo
player npm package.
vue-vimeo-player
@Vimeo/player
has an option for responsive
which is set to false as default.
github/vimeo/player
which you can pass through vue-vimeo-player
via the options
prop
such that
<template>
<vimeo-player
class="vimeo"
ref="player"
:options="{ responsive: true }"
:video-id="videoID"
@ready="onReady"
:autoplay="true"
:player-height="320"
:player-width="640"
loop="1"
></vimeo-player>
</template>
<style lang="scss">
.vimeo {
left: 0;
top: 0;
height: 100%;
width: 100%;
// max-height: 200px;
position: absolute;
}
</style>
You may still need to handle css widths/styling