Fullscreen HTML5 Video in Safari via JavaScript

In Safari 5 HTML5 videos played in the <video> tag can now be made fullscreen, if you’re using the default controls then a button is available, but if you’re overriding them with a custom control you can use:

webkitEnterFullScreen();

This needs to be called on the video tag element, for example, to fullscreen the first video tag on the page use:

document.getElementsByTagName('video')[0].webkitEnterFullscreen();

One thought on “Fullscreen HTML5 Video in Safari via JavaScript

  1. Hi I’m trying to apply the code to my .html page but it seems that i’m missing something.

    I hope you can help me
    Sincerely

    Jim

Comments are closed.