YouTube JavaScript Player API

YouTube JavaScript Player API

YouTube JavaScript Player API

For my Youtube Channel Gallery plugin I wanted to deal with the YouTube JavaScript Player API in depth, but using the player from an iframe instead of the API, given that I am using it this way in the plugin. My main interest lies in playing the YouTube player controllers through the API, to value the possibility of offering a custom control bar, keeping the use of the YouTube player and using the API functions.

First, I created a simple prototype to show the functionality of some basic functions. In this example, we can see how easily you can control the functionality of the player from controls created in our page.

Following, I created a prototype which gathers the different tools of the YouTube player control bar, managed from the API. Some aspects of the YouTube API to take into account are:

  • The function ‘isMuted’ does not returns ‘true’ if the sound has been set to 0 with the volume control, but it does change the sound icon of the YouTube player controls to ‘Muted’.
  • The function ‘getDuration’, which returns the full-time of the video, and the function ‘getCurrentTime’, which returns the playing state, do not match when reaching the end of the video.
  • The functions ‘getPlaybackQuality’, which returns the quality with which the video will be played, and ‘getAvailableQualityLevels’, which returns the qualities in which the video is available, do not offer information before the video is played.
  • The controls ‘Full screen’ and ‘Watch later’ do not have entry functions from the API.
Tags:
©2021 PoseLab SL. All rights reserved.