Which team duplicates the function of the fullscreen button inside youtube? I do custom management, the design provides such a "third-party" button. Now here's the code:

function onYouTubePlayerAPIReady() { player = new YT.Player('video-1', { events: { 'onReady': onPlayerReady } }); player2 = new YT.Player('video-2', { events: { 'onReady': onPlayerReady } }); } function onPlayerReady(event) { var stopButton = $('.videotab--header label'); stopButton.click(function() { player.stopVideo(); player2.stopVideo(); }); var playButton = $('.play-video--button'); playButton.click(function() { player2.playVideo(); }); } 

    2 answers 2

     //ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° наТатия Π½Π° ΠΊΠ°ΡΡ‚ΠΎΠΌΠ½ΡƒΡŽ ΠΊΠ½ΠΎΠΏΠΊΡƒ $(playButtonClass).addEventListener('click', function(){ // Воспроизвидим ΠΈ ΠΏΠΎΡ‚ΠΎΠΌ Ρ€Π°Π·Π²ΠΎΡ€Π°Ρ€ΠΈΡ‡Π°Π²Π°Π΅ΠΌ Π½Π° вСсь экран player.playVideo(); var playerElement = $(playerWrapperClass); var requestFullScreen = playerElement.requestFullScreen || playerElement.mozRequestFullScreen || playerElement.webkitRequestFullScreen; if (requestFullScreen) { requestFullScreen.bind(playerElement)(); } }) 

    Found such an option.

    A quick Google search says that the idea itself is not included in the Youtube philosophy.

       $('.button').click(function() { var elem = document.getElementById("video"); if (elem.requestFullscreen) { elem.requestFullscreen(); } else if (elem.mozRequestFullScreen) { elem.mozRequestFullScreen(); } else if (elem.webkitRequestFullscreen) { elem.webkitRequestFullscreen(); } }); 

      but with this, the following points must be spelled out in the iframe tag:

       webkitallowfullscreen mozallowfullscreen allowfullscreen