gajus/youtube-player

playerVars not working with loadVideoById method

lbineau opened this issue · 4 comments

player.loadVideoById({
  'videoId': 'theVideoId',
  'playerVars': { 'autoplay': 0, 'controls': 0 }
})

playerVars doesn't seems to be added to iframe url (described here https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player)
Am I missing something?

It seems that it is options for YouTubePlayer instance

let player = YouTubePlayer('domId', {
  'videoId': 'theVideoId',
  'playerVars': { 'autoplay': 0, 'controls': 0 }
})

But loadVideoById play the video automatically is it a normal behavior?

player.loadVideoById('anotherId')

my playerVars also stopped working

gajus commented

It is a very simple project and if you find and issue, it will be the easiest for you to replicate the issue and contribute a fix.

I'm pretty sure the loadVideoById in the underlying API method doesn't allow for playerVars.
https://developers.google.com/youtube/iframe_api_reference#loadVideoById