Closed Eraldo closed 6 years ago
Currently lib is only processing embedding video part, without real support for JS API (events, etc.).
By YT documentation what can be done is setting id
and enablejsapi
to returned iframe,
this.embedService.embed(`${this.ytUrl}?enablejsapi=1`, attr: { id: 'iframe-example' } })
and then,
function onYouTubeIframeAPIReady() {
player = new YT.Player('iframe-example', {
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
// do something..
}
I am wondering how to use
enablejsapi
to be able to control the player.I guess this is a feature request: It would be cool to have access to the player api to be able to control it according to the official docs: https://developers.google.com/youtube/iframe_api_reference#Examples
Maybe this is already possible and I just did not understand how. :)