Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play youtube video in fullscreen on button click on mobile browsers

I want to play a youtube video in fullscreen on click of a button. I currently have the following iframe:

<div class="youtube-trailer">
    <iframe class="youtube-player" type="text/html" src="http://www.youtube.com/embed/whatever" allowfullscreen frameborder="0"></iframe>
</div>

On Safari Mobile, specifically, when a press the Play button the video launches in full screen which is the desired behavior. This is fine. I don't want the iframe displayed on the page though. I just want a button that will open the video in fullscreen using the native video player. i.e. i don't want to create an overly-elaborate lightbox to house the video.

Anyone have any ideas?

like image 245
garethdn Avatar asked May 26 '13 20:05

garethdn


People also ask

How do I make my YouTube video play full screen automatically?

Make sure its YouTube settings and not just the regular settings for your Google account. In the settings, click on Playback from the left sidebar. Here, check the box in front of Always play HD on full-screen (when available). Click on save towards the right.

Why won't my YouTube videos play in full screen?

Sometimes a YouTube page will load incorrectly, causing graphical issues in the process. If this is the reason you're encountering a full-screen error, pressing the F5 key or clicking the "Refresh" button will reload the YouTube page and fix the problem.


1 Answers

The standard youtube video link format is:

http://www.youtube.com/watch?v=Lv-sY_z8MNs

You can link directly to the full screen video (without opening a new window) by adding "_popup" after "watch" in the URL:

http://www.youtube.com/watch_popup?v=Lv-sY_z8MNs

This should work for both mobile and desktop browsers. Naturally, if you did end up wanting to open your link in a new page, simply add "target="_blank" to your opening anchor tag.

like image 81
Victor Paredes Avatar answered Nov 14 '22 23:11

Victor Paredes