vue-youtube-embed icon indicating copy to clipboard operation
vue-youtube-embed copied to clipboard

how to lazy load youtube video?

Open codeitlikemiley opened this issue 8 years ago • 1 comments

is there a way i can lazy load this , help would be appreciated thanks

codeitlikemiley avatar Nov 05 '17 09:11 codeitlikemiley

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
    }
}

eelbahri avatar Nov 08 '17 14:11 eelbahri