docs/example-app/script/index.js
function setupControls () {

      window.addEventListener('keydown', function () {
        startControlsTimeOut();
      });

      playButton.addEventListener('click', function () {
        bigscreenPlayer.play();
        startControlsTimeOut();
      });

      pauseButton.addEventListener('click', function () {
        bigscreenPlayer.pause();
        startControlsTimeOut();
      });

      seekForwardButton.addEventListener('click', function () {
        bigscreenPlayer.setCurrentTime(bigscreenPlayer.getCurrentTime() + 10);
        startControlsTimeOut();
      });

      seekBackButton.addEventListener('click', function () {
        bigscreenPlayer.setCurrentTime(bigscreenPlayer.getCurrentTime() - 10);
        startControlsTimeOut();
      });

      seekToEndButton.addEventListener('click', function () {
        bigscreenPlayer.setCurrentTime(bigscreenPlayer.getDuration() - 10);
        startControlsTimeOut();
      });

      debugToolButton.addEventListener('click', function () {
        DebugTool.toggleVisibility();
        startControlsTimeOut();
      });

      bigscreenPlayer.registerForTimeUpdates(function (event) {
      });

      bigscreenPlayer.registerForStateChanges(function (event) {
        var state = 'EMPTY';
        switch (event.state) {
          case 0: state = 'STOPPED'; break;
          case 1: state = 'PAUSED'; break;
          case 2: state = 'PLAYING'; break;
          case 4: state = 'WAITING'; break;
          case 5: state = 'ENDED'; break;
          case 6: state = 'FATAL_ERROR'; break;
        }
        if (state === 'WAITING') {
          playbackElement.appendChild(playbackSpinner);
        } else {
          playbackElement.removeChild(playbackSpinner);
        }
      });
    }
function setupControls () {

      window.addEventListener('keydown', function () {
        startControlsTimeOut();
      });

      playButton.addEventListener('click', function () {
        bigscreenPlayer.play();
        startControlsTimeOut();
      });

      pauseButton.addEventListener('click', function () {
        bigscreenPlayer.pause();
        startControlsTimeOut();
      });

      seekForwardButton.addEventListener('click', function () {
        bigscreenPlayer.setCurrentTime(bigscreenPlayer.getCurrentTime() + 10);
        startControlsTimeOut();
      });

      seekBackButton.addEventListener('click', function () {
        bigscreenPlayer.setCurrentTime(bigscreenPlayer.getCurrentTime() - 10);
        startControlsTimeOut();
      });

      seekToEndButton.addEventListener('click', function () {
        bigscreenPlayer.setCurrentTime(bigscreenPlayer.getDuration() - 10);
        startControlsTimeOut();
      });

      debugToolButton.addEventListener('click', function () {
        DebugTool.toggleVisibility();
        startControlsTimeOut();
      });

      bigscreenPlayer.registerForTimeUpdates(function (event) {
      });

      bigscreenPlayer.registerForStateChanges(function (event) {
        var state = 'EMPTY';
        switch (event.state) {
          case 0: state = 'STOPPED'; break;
          case 1: state = 'PAUSED'; break;
          case 2: state = 'PLAYING'; break;
          case 4: state = 'WAITING'; break;
          case 5: state = 'ENDED'; break;
          case 6: state = 'FATAL_ERROR'; break;
        }
        if (state === 'WAITING') {
          playbackElement.appendChild(playbackSpinner);
        } else {
          playbackElement.removeChild(playbackSpinner);
        }
      });
    }
function setupControls ( ) { window . addEventListener ( 'keydown' , function ( ) { startControlsTimeOut ( ) ; } ) ; playButton . addEventListener ( 'click' , function ( ) { bigscreenPlayer . play ( ) ; startControlsTimeOut ( ) ; } ) ; pauseButton . addEventListener ( 'click' , function ( ) { bigscreenPlayer . pause ( ) ; startControlsTimeOut ( ) ; } ) ; seekForwardButton . addEventListener ( 'click' , function ( ) { bigscreenPlayer . setCurrentTime ( bigscreenPlayer . getCurrentTime ( ) + 10 ) ; startControlsTimeOut ( ) ; } ) ; seekBackButton . addEventListener ( 'click' , function ( ) { bigscreenPlayer . setCurrentTime ( bigscreenPlayer . getCurrentTime ( ) - 10 ) ; startControlsTimeOut ( ) ; } ) ; seekToEndButton . addEventListener ( 'click' , function ( ) { bigscreenPlayer . setCurrentTime ( bigscreenPlayer . getDuration ( ) - 10 ) ; startControlsTimeOut ( ) ; } ) ; debugToolButton . addEventListener ( 'click' , function ( ) { DebugTool . toggleVisibility ( ) ; startControlsTimeOut ( ) ; } ) ; bigscreenPlayer . registerForTimeUpdates ( function ( event ) { } ) ; bigscreenPlayer . registerForStateChanges ( function ( event ) { var state = 'EMPTY' ; switch ( event . state ) { case 0 : state = 'STOPPED' ; break ; case 1 : state = 'PAUSED' ; break ; case 2 : state = 'PLAYING' ; break ; case 4 : state = 'WAITING' ; break ; case 5 : state = 'ENDED' ; break ; case 6 : state = 'FATAL_ERROR' ; break ; } if ( state === 'WAITING' ) { playbackElement . appendChild ( playbackSpinner ) ; } else { playbackElement . removeChild ( playbackSpinner ) ; } } ) ; }
Create event listeners
Create event listeners