Open thesayyn opened 3 years ago
For a quick fix export the player variable in the svelte YT component and bind:player
in the parent to access the payer instance.
bind:player didn't work for me (or I did it wrong)
however, I could access the player from event.detail.target in the onReady event
// script
let player
function onReady(event) {
player = event.detail.target
player.playVideo()
}
// html
<YouTube on:ready={onReady}></YouTube>
MarcSallent THANK YOU SO MUCH I had not found the solution before read this.
The doc says that we can access the underlying youtube API with ready events target property which is null in my case.