I have a Youtube video embeded on a webpage.
Is it possible to have the video go full screen when the user presses play, using the HTML5 iframe with Youtube's API?
Using the Chromeless player is not an option as the website is intended for iPads.
Update November 2013: this is possible - real fullscreen, not full window, with the following technique. As @chrisg says, the YouTube JS API does not have a 'fullscreen by default' option.
Here's the code.
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)(); } })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With