youtube-player.js

export const PlayerState = {
  UNSTARTED: -1,
  ENDED: 0,
  PLAYING: 1,
  PAUSED: 2,
  BUFFERING: 3,
  CUED: 5
};

export function PlayerStateText(state) {
  switch (state) {
    case 0:
      return 'ended';
    case 1:
      return 'playing';
    case 2:
      return 'paused';
    case 3:
      return 'buffering';
    case 4:
      return 'cued';
    case -1:
      return 'unstarted';
    default:
      return '';
  }
}