Play youtube video in fullscreen on button click on mobile browsers

16,113

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.

Share:
16,113
garethdn
Author by

garethdn

Updated on June 15, 2022

Comments

  • garethdn
    garethdn almost 2 years

    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?