Questions about the YouTube player_api code


Like this:
const videoId =;("data-id")


No, not like that. You have too many things there.

After the equals sign you should just have;


Got it yellow dot:


What do you mean by “yellow dot”?




Yes, that shouldn’t be there. You have more text after the equals sign than what was instructed.




Okay. Looking down through the addVideo function, the next piece to update is the Object.assign line.

Instead of desiredPlayerVars, we want that to be opts.playerVars instead.


Top and bottom?

  function addVideo(video, opts.playerVars, opts) {
  const videoId =;
    const defaultPlayerVars = {
      autoplay: 1,
      controls: 1,
      showinfo: 1,
      rel: 0,
      iv_load_policy: 3,
      cc_load_policy: 0,
      fs: 0,
      disablekb: 1
    const playerVars = Object.assign(defaultPlayerVars, opts.playerVars);
    players.push(new YT.Player(video,{


On the next line is a video keyword, that we want to be instead.


There’s a red dot now:

function addVideo(video, opts.playerVars, opts) {


No, you don’t change the function parameters. Put that back.

I explicitly instructed you to only change the one on the Object.assign line.






Okay, let’s go back to the line just below the Object.assign line. There’s a video keyword that needs to be updated to be instead.


I did Here:


Good one. We can now remove the first two parameters from addVideo, both in the function declaration and in the init function where it’s used, so that only opts is used.


Which didn’t I do?


The one in the init function.


In here?
const playerVars = opts.playerVars || {};