var $ = document.querySelector.bind(document); // Once the user clicks a custom fullscreen button $(playButtonClass).addEventListener('click', function(){ // Play video and go fullscreen player.playVideo(); var playerElement = $(playerWrapperClass); var requestFullScreen = playerElement.requestFullScreen || playerElement.mozRequestFullScreen || playerElement.webkitRequestFullScreen; if (requestFullScreen) { requestFullScreen.bind(playerElement)(); } })