vue-youtube-embed
vue-youtube-embed copied to clipboard
how to lazy load youtube video?
is there a way i can lazy load this , help would be appreciated thanks
You can use "ready" attribute with component, here is how I did :
<div :class="{'spinner': !isLoaded}"></div>
<youtube
class="video"
player-width="100%"
player-height="100%"
:video-id='yourId'
@ready="ready"></youtube>
then with this method :
methods: {
ready (player) {
this.player = player
this.isLoaded = true
}
}