videojs-contrib-dash
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -1,2 +0,2 @@ | ||
/*! videojs-contrib-dash - v1.0.2 - 2015-07-23 | ||
/*! videojs-contrib-dash - v1.1.0 - 2015-07-24 | ||
* Copyright (c) 2015 Brightcove */ | ||
@@ -69,3 +69,5 @@ (function(window, videojs) { | ||
// injection | ||
Html5DashJS.useVideoJSDebug(videojs); | ||
if (Html5DashJS.useVideoJSDebug) { | ||
Html5DashJS.useVideoJSDebug(videojs); | ||
} | ||
@@ -123,115 +125,2 @@ // Save the context after the first initialization for subsequent instances | ||
/* | ||
* Change MediaPlayer.utils.Debug to log using videojs debugger in order to | ||
* keep the console.log clean | ||
*/ | ||
Html5DashJS.useVideoJSDebug = function (videojs) { | ||
if (Html5DashJS.originalDebug) { | ||
return; | ||
} | ||
if (videojs && videojs.log && videojs.log.debug) { | ||
Html5DashJS.originalDebug = MediaPlayer.utils.Debug; | ||
// Replace the global Debug function in Dash.js | ||
MediaPlayer.utils.Debug = function () { | ||
var logToBrowserConsole = true, | ||
showLogTimestamp = false, | ||
showCalleeName = false, | ||
startTime = new Date().getTime(), | ||
eventBus; | ||
return { | ||
system: undefined, | ||
eventBus: undefined, | ||
setup: function() { | ||
this.system.mapValue('log', this.log); | ||
eventBus = this.eventBus; | ||
}, | ||
/** | ||
* Prepends a timestamp in milliseconds to each log message. | ||
* @param {boolean} value Set to true if you want to see a timestamp in each log message | ||
* @default false | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
setLogTimestampVisible: function(value) { | ||
showLogTimestamp = value; | ||
}, | ||
/** | ||
* Prepends the callee object name, and media type if available, to each log message. | ||
* @param {boolean} value Set to true if you want to see a object name and media type in | ||
* each log message. | ||
* @default false | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
showCalleeName: function(value) { | ||
showCalleeName = value; | ||
}, | ||
/** | ||
* Toggles logging to the browser's javascript console. If you set to false you will | ||
* still receive a log event with the same message. | ||
* @param {boolean} value Set to false if you want to turn off logging to the browser's | ||
* console. | ||
* @default true | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
setLogToBrowserConsole: function(value) { | ||
logToBrowserConsole = value; | ||
}, | ||
/** | ||
* Use this method to get the state of logToBrowserConsole. | ||
* @returns {boolean} The current value of logToBrowserConsole | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
getLogToBrowserConsole: function() { | ||
return logToBrowserConsole; | ||
}, | ||
/** | ||
* This method will allow you send log messages to either the browser's console and/or | ||
* dispatch an event to capture at the media player level. | ||
* @param arguments The message you want to log. The Arguments object is supported for | ||
* this method so you can send in comma separated logging items. | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
log: function () { | ||
var message = '', | ||
logTime = null; | ||
if (showLogTimestamp) { | ||
logTime = new Date().getTime(); | ||
message += '[' + (logTime - startTime) + ']'; | ||
} | ||
if (showCalleeName && this.getName) { | ||
message += '[' + this.getName() + ']'; | ||
} | ||
if (this.getMediaType && this.getMediaType()) { | ||
message += '[' + this.getMediaType() + ']'; | ||
} | ||
if (message.length > 0) { | ||
message += ' '; | ||
} | ||
Array.apply(null, arguments).forEach(function(item) { | ||
message += item + ' '; | ||
}); | ||
if (logToBrowserConsole) { | ||
videojs.log.debug(message); | ||
} | ||
eventBus.dispatchEvent({ | ||
type: 'log', | ||
message: message | ||
}); | ||
} | ||
}; | ||
}; | ||
} | ||
}; | ||
/* | ||
* Add a css-class that is used to temporarily hide the error dialog while so that | ||
@@ -238,0 +127,0 @@ * we don't see a flash of the dialog box when we remove the video element's src |
@@ -1,3 +0,3 @@ | ||
/*! videojs-contrib-dash - v1.0.2 - 2015-07-23 | ||
/*! videojs-contrib-dash - v1.1.0 - 2015-07-24 | ||
* Copyright (c) 2015 Brightcove */ | ||
!function(a,b){"use strict";function c(a,d){var e,f=d.options();this.tech_=d,this.el_=d.el(),this.elParent_=this.el_.parentNode,a.src&&(d.isReady_=!1,e=a.src,this.keySystemOptions_=c.buildDashJSProtData(a.keySystemOptions),c.hideErrors(this.elParent_),c.useVideoJSDebug(b),c.context_=c.context_||new Dash.di.DashContext,this.mediaPlayer_=new MediaPlayer(c.context_),this.mediaPlayer_.startup(),this.mediaPlayer_.attachView(this.el_),f.autoplay||this.mediaPlayer_.setAutoPlay(!1),this.mediaPlayer_.retrieveManifest(e,b.bind(this,this.initializeDashJS)))}var d=function(a){return"[object Array]"===Object.prototype.toString.call(a)},e=function(a){return"[object Object]"===Object.prototype.toString.call(a)},f=function(a,b){var c,d,g,h;h={};for(c in b)b.hasOwnProperty(c)&&(d=a[c],g=b[c],e(d)&&e(g)?a[c]=f(d,g):a[c]=b[c]);return a};c.prototype.initializeDashJS=function(a,d){var e={};return d?(c.showErrors(this.elParent_),this.tech_.triggerReady(),void this.dispose()):(c.getWidevineProtectionData&&(e=c.getWidevineProtectionData(a),this.keySystemOptions_=f(this.keySystemOptions_,e)),void this.resetSrc_(b.bind(this,function(){c.showErrors(this.elParent_),this.mediaPlayer_.attachSource(a,null,this.keySystemOptions_),this.tech_.triggerReady()})))},c.useVideoJSDebug=function(a){c.originalDebug||a&&a.log&&a.log.debug&&(c.originalDebug=MediaPlayer.utils.Debug,MediaPlayer.utils.Debug=function(){var b,c=!0,d=!1,e=!1,f=(new Date).getTime();return{system:void 0,eventBus:void 0,setup:function(){this.system.mapValue("log",this.log),b=this.eventBus},setLogTimestampVisible:function(a){d=a},showCalleeName:function(a){e=a},setLogToBrowserConsole:function(a){c=a},getLogToBrowserConsole:function(){return c},log:function(){var g="",h=null;d&&(h=(new Date).getTime(),g+="["+(h-f)+"]"),e&&this.getName&&(g+="["+this.getName()+"]"),this.getMediaType&&this.getMediaType()&&(g+="["+this.getMediaType()+"]"),g.length>0&&(g+=" "),Array.apply(null,arguments).forEach(function(a){g+=a+" "}),c&&a.log.debug(g),b.dispatchEvent({type:"log",message:g})}}})},c.hideErrors=function(a){a.className+="vjs-dashjs-hide-errors"},c.showErrors=function(a){setTimeout(function(){a.className=a.className.replace("vjs-dashjs-hide-errors","")},250)},c.buildDashJSProtData=function(a){var b,c,e,g={};if(!a||!d(a))return g;for(e=0;e<a.length;e++)b=a[e],c=f({},b.options),c.licenseUrl&&(c.laURL=c.licenseUrl,delete c.licenseUrl),g[b.name]=c;return g},c.prototype.resetSrc_=function(a){this.el_&&(this.el_.src="",this.el_.setMediaKeys?this.el_.setMediaKeys(null).then(a,a):a())},c.prototype.dispose=function(){this.mediaPlayer_&&this.mediaPlayer_.reset(),this.resetSrc_(function(){})},a.MediaSource&&b.Html5.registerSourceHandler({canHandleSource:function(a){var b=/^application\/dash\+xml/i,c=/\.mpd/i;return b.test(a.type)?"probably":c.test(a.src)?"maybe":""},handleSource:function(a,b){return new c(a,b)}}),b.Html5DashJS=c}(window,window.videojs); | ||
!function(a,b){"use strict";function c(a,d){var e,f=d.options();this.tech_=d,this.el_=d.el(),this.elParent_=this.el_.parentNode,a.src&&(d.isReady_=!1,e=a.src,this.keySystemOptions_=c.buildDashJSProtData(a.keySystemOptions),c.hideErrors(this.elParent_),c.useVideoJSDebug&&c.useVideoJSDebug(b),c.context_=c.context_||new Dash.di.DashContext,this.mediaPlayer_=new MediaPlayer(c.context_),this.mediaPlayer_.startup(),this.mediaPlayer_.attachView(this.el_),f.autoplay||this.mediaPlayer_.setAutoPlay(!1),this.mediaPlayer_.retrieveManifest(e,b.bind(this,this.initializeDashJS)))}var d=function(a){return"[object Array]"===Object.prototype.toString.call(a)},e=function(a){return"[object Object]"===Object.prototype.toString.call(a)},f=function(a,b){var c,d,g,h;h={};for(c in b)b.hasOwnProperty(c)&&(d=a[c],g=b[c],e(d)&&e(g)?a[c]=f(d,g):a[c]=b[c]);return a};c.prototype.initializeDashJS=function(a,d){var e={};return d?(c.showErrors(this.elParent_),this.tech_.triggerReady(),void this.dispose()):(c.getWidevineProtectionData&&(e=c.getWidevineProtectionData(a),this.keySystemOptions_=f(this.keySystemOptions_,e)),void this.resetSrc_(b.bind(this,function(){c.showErrors(this.elParent_),this.mediaPlayer_.attachSource(a,null,this.keySystemOptions_),this.tech_.triggerReady()})))},c.hideErrors=function(a){a.className+="vjs-dashjs-hide-errors"},c.showErrors=function(a){setTimeout(function(){a.className=a.className.replace("vjs-dashjs-hide-errors","")},250)},c.buildDashJSProtData=function(a){var b,c,e,g={};if(!a||!d(a))return g;for(e=0;e<a.length;e++)b=a[e],c=f({},b.options),c.licenseUrl&&(c.laURL=c.licenseUrl,delete c.licenseUrl),g[b.name]=c;return g},c.prototype.resetSrc_=function(a){this.el_&&(this.el_.src="",this.el_.setMediaKeys?this.el_.setMediaKeys(null).then(a,a):a())},c.prototype.dispose=function(){this.mediaPlayer_&&this.mediaPlayer_.reset(),this.resetSrc_(function(){})},a.MediaSource&&b.Html5.registerSourceHandler({canHandleSource:function(a){var b=/^application\/dash\+xml/i,c=/\.mpd/i;return b.test(a.type)?"probably":c.test(a.src)?"maybe":""},handleSource:function(a,b){return new c(a,b)}}),b.Html5DashJS=c}(window,window.videojs); |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"author": { | ||
@@ -11,0 +11,0 @@ "name": "Brightcove" |
@@ -67,3 +67,5 @@ (function(window, videojs) { | ||
// injection | ||
Html5DashJS.useVideoJSDebug(videojs); | ||
if (Html5DashJS.useVideoJSDebug) { | ||
Html5DashJS.useVideoJSDebug(videojs); | ||
} | ||
@@ -121,115 +123,2 @@ // Save the context after the first initialization for subsequent instances | ||
/* | ||
* Change MediaPlayer.utils.Debug to log using videojs debugger in order to | ||
* keep the console.log clean | ||
*/ | ||
Html5DashJS.useVideoJSDebug = function (videojs) { | ||
if (Html5DashJS.originalDebug) { | ||
return; | ||
} | ||
if (videojs && videojs.log && videojs.log.debug) { | ||
Html5DashJS.originalDebug = MediaPlayer.utils.Debug; | ||
// Replace the global Debug function in Dash.js | ||
MediaPlayer.utils.Debug = function () { | ||
var logToBrowserConsole = true, | ||
showLogTimestamp = false, | ||
showCalleeName = false, | ||
startTime = new Date().getTime(), | ||
eventBus; | ||
return { | ||
system: undefined, | ||
eventBus: undefined, | ||
setup: function() { | ||
this.system.mapValue('log', this.log); | ||
eventBus = this.eventBus; | ||
}, | ||
/** | ||
* Prepends a timestamp in milliseconds to each log message. | ||
* @param {boolean} value Set to true if you want to see a timestamp in each log message | ||
* @default false | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
setLogTimestampVisible: function(value) { | ||
showLogTimestamp = value; | ||
}, | ||
/** | ||
* Prepends the callee object name, and media type if available, to each log message. | ||
* @param {boolean} value Set to true if you want to see a object name and media type in | ||
* each log message. | ||
* @default false | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
showCalleeName: function(value) { | ||
showCalleeName = value; | ||
}, | ||
/** | ||
* Toggles logging to the browser's javascript console. If you set to false you will | ||
* still receive a log event with the same message. | ||
* @param {boolean} value Set to false if you want to turn off logging to the browser's | ||
* console. | ||
* @default true | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
setLogToBrowserConsole: function(value) { | ||
logToBrowserConsole = value; | ||
}, | ||
/** | ||
* Use this method to get the state of logToBrowserConsole. | ||
* @returns {boolean} The current value of logToBrowserConsole | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
getLogToBrowserConsole: function() { | ||
return logToBrowserConsole; | ||
}, | ||
/** | ||
* This method will allow you send log messages to either the browser's console and/or | ||
* dispatch an event to capture at the media player level. | ||
* @param arguments The message you want to log. The Arguments object is supported for | ||
* this method so you can send in comma separated logging items. | ||
* @memberof MediaPlayer.utils.Debug# | ||
*/ | ||
log: function () { | ||
var message = '', | ||
logTime = null; | ||
if (showLogTimestamp) { | ||
logTime = new Date().getTime(); | ||
message += '[' + (logTime - startTime) + ']'; | ||
} | ||
if (showCalleeName && this.getName) { | ||
message += '[' + this.getName() + ']'; | ||
} | ||
if (this.getMediaType && this.getMediaType()) { | ||
message += '[' + this.getMediaType() + ']'; | ||
} | ||
if (message.length > 0) { | ||
message += ' '; | ||
} | ||
Array.apply(null, arguments).forEach(function(item) { | ||
message += item + ' '; | ||
}); | ||
if (logToBrowserConsole) { | ||
videojs.log.debug(message); | ||
} | ||
eventBus.dispatchEvent({ | ||
type: 'log', | ||
message: message | ||
}); | ||
} | ||
}; | ||
}; | ||
} | ||
}; | ||
/* | ||
* Add a css-class that is used to temporarily hide the error dialog while so that | ||
@@ -236,0 +125,0 @@ * we don't see a flash of the dialog box when we remove the video element's src |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35442
13
471