From 86e2dfd4ab4cc557e7c1ddbfc7cbe512aa325922 Mon Sep 17 00:00:00 2001 From: Erik Skogby Date: Wed, 12 Mar 2014 14:52:31 +0100 Subject: [PATCH 1/6] Made vjs.get work in IE < 10 --- src/js/lib.js | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/js/lib.js b/src/js/lib.js index 51667ef722..e3e0957686 100644 --- a/src/js/lib.js +++ b/src/js/lib.js @@ -574,6 +574,7 @@ vjs.createTimeRange = function(start, end){ vjs.get = function(url, onSuccess, onError){ var local, request; + onError = onError || function(){}; if (typeof XMLHttpRequest === 'undefined') { window.XMLHttpRequest = function () { try { return new window.ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch (e) {} @@ -584,8 +585,26 @@ vjs.get = function(url, onSuccess, onError){ } request = new XMLHttpRequest(); + if(!('withCredentials' in request) && window.XDomainRequest) { + request = new window.XDomainRequest(); + request.onload = function() { + onSuccess(request.responseText); + }; + request.onprogress = function() {}; + request.onerror = onError; + request.ontimeout = onError; + try { + request.open('GET', url); + request.send(); + } catch (e) { + onError(e); + } + return; + } + try { - request.open('GET', url); + request.withCredentials = true; + request.open('GET', url, true); } catch(e) { onError(e); } @@ -597,9 +616,7 @@ vjs.get = function(url, onSuccess, onError){ if (request.status === 200 || local && request.status === 0) { onSuccess(request.responseText); } else { - if (onError) { - onError(); - } + onError(); } } }; @@ -607,9 +624,7 @@ vjs.get = function(url, onSuccess, onError){ try { request.send(); } catch(e) { - if (onError) { - onError(e); - } + onError(e); } }; From 440de378be6ff32936c52fcd169c9aa33311ce1b Mon Sep 17 00:00:00 2001 From: Erik Skogby Date: Thu, 27 Mar 2014 18:01:46 +0100 Subject: [PATCH 2/6] Fixed a bug with withcredentials --- src/js/lib.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/lib.js b/src/js/lib.js index e3e0957686..4df357a257 100644 --- a/src/js/lib.js +++ b/src/js/lib.js @@ -603,10 +603,11 @@ vjs.get = function(url, onSuccess, onError){ } try { - request.withCredentials = true; request.open('GET', url, true); + request.withCredentials = true; } catch(e) { onError(e); + return; } local = (url.indexOf('file:') === 0 || (window.location.href.indexOf('file:') === 0 && url.indexOf('http') === -1)); From b7311f3f379a3bbf06febd8613f6c4572eee7a05 Mon Sep 17 00:00:00 2001 From: Erik Skogby Date: Tue, 15 Apr 2014 09:06:07 +0200 Subject: [PATCH 3/6] Set the withCredentials flag as an optional parameter --- src/js/lib.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/lib.js b/src/js/lib.js index 4df357a257..6b2a506abc 100644 --- a/src/js/lib.js +++ b/src/js/lib.js @@ -566,12 +566,13 @@ vjs.createTimeRange = function(start, end){ /** * Simple http request for retrieving external files (e.g. text tracks) - * @param {String} url URL of resource - * @param {Function=} onSuccess Success callback - * @param {Function=} onError Error callback + * @param {String} url URL of resource + * @param {Function=} onSuccess Success callback + * @param {Function=} onError Error callback + * @param {Boolean} withCredentials Flag which allow credentials * @private */ -vjs.get = function(url, onSuccess, onError){ +vjs.get = function(url, onSuccess, onError, withCredentials){ var local, request; onError = onError || function(){}; @@ -604,7 +605,9 @@ vjs.get = function(url, onSuccess, onError){ try { request.open('GET', url, true); - request.withCredentials = true; + if(withCredentials) { + request.withCredentials = true; + } } catch(e) { onError(e); return; From 3fd0c92c95a19b8b49d9aeaae9607b72e54597bb Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Wed, 7 May 2014 15:23:32 -0700 Subject: [PATCH 4/6] Added line to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fac9605d54..63e21f4d9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ CHANGELOG * Added the option to provide an array of child components instead of an object [[view](https://github.com/videojs/video.js/pull/1093)] * Fixed casing on webkitRequestFullscreen [[view](https://github.com/videojs/video.js/pull/1101)] * Made tap events on mobile less sensitive to touch moves [[view](https://github.com/videojs/video.js/pull/1111)] +* Fixed the default flag for captions/subtitles tracks [[view](https://github.com/videojs/video.js/pull/1153)] -------------------- From 92eac13caa393d7bfe5b6bfefa6d683fd2c6b9e4 Mon Sep 17 00:00:00 2001 From: Matthew McClure Date: Wed, 7 May 2014 15:31:02 -0700 Subject: [PATCH 5/6] More explicit MIME type note Added a more explicit MIME type note in setup. Moved to a footnote and made comment more verbose to avoid confusion. --- docs/guides/setup.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/guides/setup.md b/docs/guides/setup.md index 578442993f..706c6f4bd9 100644 --- a/docs/guides/setup.md +++ b/docs/guides/setup.md @@ -47,8 +47,7 @@ With Video.js you just use an HTML5 video tag to embed a video. Video.js will th - `video-js` applies styles that are required for Video.js functionality, like fullscreen and subtitles. - `vjs-default-skin` applies the default skin to the HTML controls, and can be removed or overridden to create your own controls design. -Otherwise include/exclude attributes, settings, sources, and tracks exactly as you would for HTML5 video. You may also need to add the video MIME types to your server configuration as documented [here](http://www.ewbooks.info/hotpot/hotpotatoes-xhtml5-audio-video) - +Otherwise include/exclude attributes, settings, sources, and tracks exactly as you would for HTML5 video.* ```html