Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update to version 1.0.1

  • Loading branch information...
commit a4a2d40ec363deb0fdba5ad5ad00c785b682f7ef 1 parent dabe162
Brad Dougherty authored
16  dist/bigscreen.js
... ...
@@ -1,6 +1,6 @@
1 1
 /*!
2 2
 * BigScreen
3  
-* v1.0.0 - 2012-08-26
  3
+* v1.0.1 - 2012-10-04
4 4
 * https://github.com/bdougherty/BigScreen
5 5
 * Copyright 2012 Brad Dougherty; Apache 2.0 License
6 6
 */
@@ -113,6 +113,7 @@
113 113
 	}
114 114
 
115 115
 	var lastFullscreenVideo = null;
  116
+	var hasControls = null;
116 117
 
117 118
 	// Check to see if there is a <video> and if the video has webkitEnterFullscreen, try it.
118 119
 	// Metadata needs to be loaded for it to work, so load() if we need to.
@@ -125,11 +126,13 @@
125 126
 					videoElement.addEventListener('loadedmetadata', function onMetadataLoaded() {
126 127
 						videoElement.removeEventListener('loadedmetadata', onMetadataLoaded, false);
127 128
 						videoElement.webkitEnterFullscreen();
  129
+						hasControls = !!videoElement.getAttribute('controls');
128 130
 					}, false);
129 131
 					videoElement.load();
130 132
 				}
131 133
 				else {
132 134
 					videoElement.webkitEnterFullscreen();
  135
+					hasControls = !!videoElement.getAttribute('controls');
133 136
 				}
134 137
 
135 138
 				lastFullscreenVideo = videoElement;
@@ -187,6 +190,16 @@
187 190
 	}, 100, true);
188 191
 
189 192
 	var callOnExit = debounce(function() {
  193
+		// Fix a bug present in some versions of WebKit that will show the native controls when
  194
+		// exiting, even if they were not showing before.
  195
+		if (lastFullscreenVideo && !hasControls) {
  196
+			lastFullscreenVideo.setAttribute('controls', 'controls');
  197
+			lastFullscreenVideo.removeAttribute('controls');
  198
+		}
  199
+
  200
+		lastFullscreenVideo = null;
  201
+		hasControls = null;
  202
+
190 203
 		bigscreen.onexit.call(bigscreen);
191 204
 	}, 200, true);
192 205
 
@@ -240,7 +253,6 @@
240 253
 		exit: function() {
241 254
 			removeWindowResizeHack(); // remove here if exit is called manually, so two onexit events are not fired
242 255
 			document[fn.exit]();
243  
-			lastFullscreenVideo = null;
244 256
 		},
245 257
 		toggle: function(element) {
246 258
 			if (bigscreen.element) {
4  dist/bigscreen.min.js
... ...
@@ -1,7 +1,7 @@
1 1
 /*!
2 2
 * BigScreen
3  
-* v1.0.0 - 2012-08-26
  3
+* v1.0.1 - 2012-10-04
4 4
 * https://github.com/bdougherty/BigScreen
5 5
 * Copyright 2012 Brad Dougherty; Apache 2.0 License
6 6
 */
7  
-(function(a,b,c){function f(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}}function g(a){var b=null;if(a.tagName==="VIDEO")b=a;else{var c=a.getElementsByTagName("video");c[0]&&(b=c[0])}return b}function i(a){var b=g(a);if(b&&b.webkitEnterFullscreen){try{b.readyState<b.HAVE_METADATA?(b.addEventListener("loadedmetadata",function d(){b.removeEventListener("loadedmetadata",d,!1),b.webkitEnterFullscreen()},!1),b.load()):b.webkitEnterFullscreen(),h=b,b.play(),n(),setTimeout(j,500)}catch(c){p.onerror.call(b)}return}p.onerror.call(a)}function j(){if(h){if(h.webkitDisplayingFullscreen===!0)return setTimeout(j,500);o()}}function k(){p.element||(o(),m())}function l(){c&&e.change==="webkitfullscreenchange"&&a.addEventListener("resize",k,!1)}function m(){c&&e.change==="webkitfullscreenchange"&&a.removeEventListener("resize",k,!1)}"use strict";var d=typeof Element!="undefined"&&"ALLOW_KEYBOARD_INPUT"in Element,e=function(){var a=[{request:"requestFullscreen",exit:"exitFullscreen",enabled:"fullscreenEnabled",element:"fullscreenElement",change:"fullscreenchange",error:"fullscreenerror"},{request:"webkitRequestFullscreen",exit:"webkitExitFullscreen",enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",change:"webkitfullscreenchange",error:"webkitfullscreenerror"},{request:"webkitRequestFullScreen",exit:"webkitCancelFullScreen",element:"webkitCurrentFullScreenElement",change:"webkitfullscreenchange",error:"webkitfullscreenerror"},{request:"mozRequestFullScreen",exit:"mozCancelFullScreen",enabled:"mozFullScreenEnabled",element:"mozFullScreenElement",change:"mozfullscreenchange",error:"mozfullscreenerror"}],c=!1,d=b.createElement("video");for(var e=0;e<a.length;e++)if(a[e].request in d){c=a[e];for(var f in c)!("on"+c[f]in b)&&!(c[f]in b)&&!(c[f]in d)&&delete c[f];break}return d=null,c}(),h=null,n=f(function(){p.onenter.call(p)},100,!0),o=f(function(){p.onexit.call(p)},200,!0),p={request:function(a){a=a||b.documentElement;if(e.request===undefined)return i(a);if(c&&b[e.enabled]===!1)return i(a);if(c&&e.enabled===undefined){e.enabled="webkitFullscreenEnabled",a[e.request](),setTimeout(function(){b[e.element]?b[e.enabled]=!0:(b[e.enabled]=!1,i(a))},250);return}try{a[e.request](d&&Element.ALLOW_KEYBOARD_INPUT),b[e.element]||a[e.request]()}catch(f){p.onerror.call(a)}},exit:function(){m(),b[e.exit](),h=null},toggle:function(a){p.element?p.exit():p.request(a)},videoEnabled:function(a){if(p.enabled)return!0;var b=g(a);return!b||b.webkitSupportsFullscreen===undefined?!1:b.readyState<b.HAVE_METADATA?"maybe":b.webkitSupportsFullscreen},onenter:function(){},onexit:function(){},onerror:function(){}};try{Object.defineProperties(p,{element:{enumerable:!0,get:function(){return h&&h.webkitDisplayingFullscreen?h:b[e.element]||null}},enabled:{enumerable:!0,get:function(){return e.exit==="webkitCancelFullScreen"&&!c?!0:b[e.enabled]||!1}}})}catch(q){p.element=null,p.enabled=!1}e.change&&b.addEventListener(e.change,function(a){p.element?(n(),l()):o()},!1),e.error&&b.addEventListener(e.error,function(a){p.onerror.call(a.target)},!1),a.BigScreen=p})(window,document,self!==top);
  7
+(function(e,t,n){"use strict";function s(e,t,n){var r;return function(){var i=this,s=arguments,o=function(){r=null,n||e.apply(i,s)},u=n&&!r;clearTimeout(r),r=setTimeout(o,t),u&&e.apply(i,s)}}function o(e){var t=null;if(e.tagName==="VIDEO")t=e;else{var n=e.getElementsByTagName("video");n[0]&&(t=n[0])}return t}function f(e){var t=o(e);if(t&&t.webkitEnterFullscreen){try{t.readyState<t.HAVE_METADATA?(t.addEventListener("loadedmetadata",function r(){t.removeEventListener("loadedmetadata",r,!1),t.webkitEnterFullscreen(),a=!!t.getAttribute("controls")},!1),t.load()):(t.webkitEnterFullscreen(),a=!!t.getAttribute("controls")),u=t,t.play(),d(),setTimeout(l,500)}catch(n){m.onerror.call(t)}return}m.onerror.call(e)}function l(){if(u){if(u.webkitDisplayingFullscreen===!0)return setTimeout(l,500);v()}}function c(){m.element||(v(),p())}function h(){n&&i.change==="webkitfullscreenchange"&&e.addEventListener("resize",c,!1)}function p(){n&&i.change==="webkitfullscreenchange"&&e.removeEventListener("resize",c,!1)}var r=typeof Element!="undefined"&&"ALLOW_KEYBOARD_INPUT"in Element,i=function(){var e=[{request:"requestFullscreen",exit:"exitFullscreen",enabled:"fullscreenEnabled",element:"fullscreenElement",change:"fullscreenchange",error:"fullscreenerror"},{request:"webkitRequestFullscreen",exit:"webkitExitFullscreen",enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",change:"webkitfullscreenchange",error:"webkitfullscreenerror"},{request:"webkitRequestFullScreen",exit:"webkitCancelFullScreen",element:"webkitCurrentFullScreenElement",change:"webkitfullscreenchange",error:"webkitfullscreenerror"},{request:"mozRequestFullScreen",exit:"mozCancelFullScreen",enabled:"mozFullScreenEnabled",element:"mozFullScreenElement",change:"mozfullscreenchange",error:"mozfullscreenerror"}],n=!1,r=t.createElement("video");for(var i=0;i<e.length;i++)if(e[i].request in r){n=e[i];for(var s in n)!("on"+n[s]in t)&&!(n[s]in t)&&!(n[s]in r)&&delete n[s];break}return r=null,n}(),u=null,a=null,d=s(function(){m.onenter.call(m)},100,!0),v=s(function(){u&&!a&&(u.setAttribute("controls","controls"),u.removeAttribute("controls")),u=null,a=null,m.onexit.call(m)},200,!0),m={request:function(e){e=e||t.documentElement;if(i.request===undefined)return f(e);if(n&&t[i.enabled]===!1)return f(e);if(n&&i.enabled===undefined){i.enabled="webkitFullscreenEnabled",e[i.request](),setTimeout(function(){t[i.element]?t[i.enabled]=!0:(t[i.enabled]=!1,f(e))},250);return}try{e[i.request](r&&Element.ALLOW_KEYBOARD_INPUT),t[i.element]||e[i.request]()}catch(s){m.onerror.call(e)}},exit:function(){p(),t[i.exit]()},toggle:function(e){m.element?m.exit():m.request(e)},videoEnabled:function(e){if(m.enabled)return!0;var t=o(e);return!t||t.webkitSupportsFullscreen===undefined?!1:t.readyState<t.HAVE_METADATA?"maybe":t.webkitSupportsFullscreen},onenter:function(){},onexit:function(){},onerror:function(){}};try{Object.defineProperties(m,{element:{enumerable:!0,get:function(){return u&&u.webkitDisplayingFullscreen?u:t[i.element]||null}},enabled:{enumerable:!0,get:function(){return i.exit==="webkitCancelFullScreen"&&!n?!0:t[i.enabled]||!1}}})}catch(g){m.element=null,m.enabled=!1}i.change&&t.addEventListener(i.change,function(e){m.element?(d(),h()):v()},!1),i.error&&t.addEventListener(i.error,function(e){m.onerror.call(e.target)},!1),e.BigScreen=m})(window,document,self!==top);
2  package.json
... ...
@@ -1,6 +1,6 @@
1 1
 {
2 2
 	"name": "BigScreen",
3  
-	"version": "1.0.0",
  3
+	"version": "1.0.1",
4 4
 	"description": "A simple library for using the JavaScript Full Screen API.",
5 5
 	"keywords": [
6 6
 		"fullscreen"

0 notes on commit a4a2d40

Please sign in to comment.
Something went wrong with that request. Please try again.