Setting up single-player tests before adding spinner

I was reading instructions here:

With this code here:

  function onYouTubeIframeAPIReady() {
    const cover = document.querySelector(".play");
    const wrapper = cover.parentElement;
    const frameContainer = wrapper.querySelector(".video");
    videoPlayer.addPlayer(frameContainer);
  }

I was able to get down to this: https://jsfiddle.net/s7w2cyqf/

  function onYouTubeIframeAPIReady() {
    const frameContainer = document.querySelector(".video");
    videoPlayer.addPlayer(frameContainer);
  }

But in those instructions,

I saw it can be changed to this:

  function onYouTubeIframeAPIReady() {
    videoPlayer.onIframeReady();
  }

Is that a change I would want to make in the code?

I couldn’t get it to work.

It’s probably fine the way it was, that was just something I had seen.

Changing that may force me to make a lot of other changes to the code which may not be necessary. So, maybe I will just leave it for now.

Aside from that, I’m not really sure if anything can be done about:

the player.h being in the code, and if it can be removed and replaced with something else.

const iframe = player.h;

Also, I don’t quite understand what the h represents.

What is its meaning?

After that, just adding the spinner which may be the easiest thing.

I think these are some of the instructions on adding the spinner

I’m not really sure.

I think that may go to the multi player code, not a single player code.

  addPlayer.init({
        afterAddPlayer: function (evt) {
            toggleSpinner(evt);
        },
        afterPlayerReady: function (evt) {
            toggleSpinner(evt);
            const cover = evt.detail.cover;
            manageCover.init(cover, showVideo);
        }
    });.

Adding the spinner to this: https://jsfiddle.net/o17mzajg/

I am not sure how that is done.

function play() {
    player.playVideo();
  }

  function addEvents(handlers) {
    eventHandlers.afterPlayerReady = handlers.afterPlayerReady;
    events.afterPlayerReady = new Event("afterPlayerReady");
  }

  function init(initEventHandlers) {
    addEvents(initEventHandlers);
    loadIframeScript();
    window.onYouTubeIframeAPIReady = onYouTubeIframeAPIReady;
  }

  return {
    addPlayer,
    init,
    play
  };
}());

videoPlayer.init({
  afterPlayerReady: function initCover() {
    manageCover.init(function playVideo() {
      videoPlayer.play();
    });
  }
});