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:


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