BigScreen — Javascript library for HTML5 Fullscreen API
brad.is
brad.is
This library could use error detection and handling as there are situations where fullscreen could be aborted or fail to start.
It's much better to attempt going fullscreen and have callbacks for errors and successfully entering fullscreen mode. Users can have preferences set to not allow it, press ESC during the transition or a number of other scenarios can occur.
There's also some CSS fixes between browsers that could be included. Safari and Chrome don't stretch the element to 100% monitor width and don't apply a background color by default so you can see 'through' the fullscreen window.
That being said it's good someone is working towards something that's relatively cross-browser. The fullscreen API right now is extremely varied but a really awesome tool for advanced web apps.
It should cover most things, but I didn't fully test it. I also couldn't get any browser to fire the native event in my testing.
It's good because it shims the W3C specified fullscreen API; you only have to learn the specified API, you don't have to learn some other API.
Having the fullscreen request shift to the descendent video also breaks the case where you actually have an element containing a video that you want to make fullscreen, for example if you have custom controls for your video element... This is simply impossible with your API.
It only falls back in the case where that doesn't work (older browser, no allowfullscreen attribute on the iframe) and supports the older API that is just for video tags.
https://github.com/bdougherty/BigScreen/blob/master/bigscree... https://github.com/sindresorhus/screenfull.js/blob/master/sr...
HTMLElement.prototype.requestFullscreen = HTMLElement.prototype.requestFullscreen
|| HTMLElement.prototype.webkitRequestFullscreen
|| HTMLElement.prototype.webkitRequestFullScreen
|| HTMLElement.prototype.mozRequestFullScreen;I also like the idea of an option to fall back to making the element fill the page if the browser doesn't support the fullscreen API. You could even breifly display the hotkey to put the browser window in fullscreen if it supports it.