Commit ce1b6231 by louyihua

Fix a url processing error in 02_html5_video.js

As the code in this .js will break the url's integrity when there is already a query string inside the video source's url and cause the url to be invalid in some cases (for example, when working with a url from Windows Azure's Media Service, the appended '?' will cause the url being invalid).
I modified the code by first checking whether the url has already had a query string, and if so, then use '&' instead of '?' to prevent the breaking, and it works for the url from Windows Azure's Media Service.
parent d76c3dfc
...@@ -186,16 +186,16 @@ function () { ...@@ -186,16 +186,16 @@ function () {
// Create HTML markup for individual sources of the HTML5 <video> // Create HTML markup for individual sources of the HTML5 <video>
// element. // element.
$.each(sourceStr, function (videoType, videoSource) { $.each(sourceStr, function (videoType, videoSource) {
if ( var url = _this.config.videoSources[videoType];
(_this.config.videoSources[videoType]) && if (url && url.length) {
(_this.config.videoSources[videoType].length)
) {
sourceStr[videoType] = sourceStr[videoType] =
'<source ' + '<source ' +
'src="' + _this.config.videoSources[videoType] + 'src="' + url +
// Following hack allows to open the same video twice // Following hack allows to open the same video twice
// https://code.google.com/p/chromium/issues/detail?id=31014 // https://code.google.com/p/chromium/issues/detail?id=31014
'?' + (new Date()).getTime() + // Check whether the url already has a '?' inside, and if so,
// use '&' instead of '?' to prevent breaking the url's integrity.
(url.indexOf('?') == -1 ? '?' : '&') + (new Date()).getTime() +
'" ' + 'type="video/' + videoType + '" ' + '" ' + 'type="video/' + videoType + '" ' +
'/> '; '/> ';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment