videojs-contrib-dash
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -1,4 +0,4 @@ | ||
/*! videojs-contrib-dash - v2.0.0 - 2015-10-16 | ||
* Copyright (c) 2015 Brightcove */ | ||
(function(window, videojs) { | ||
/*! videojs-contrib-dash - v2.1.0 - 2016-03-08 | ||
* Copyright (c) 2016 Brightcove */ | ||
(function(window, videojs, dashjs) { | ||
'use strict'; | ||
@@ -67,17 +67,16 @@ | ||
// Must be before anything is initialized since we are overridding a global object | ||
// injection | ||
if (Html5DashJS.useVideoJSDebug) { | ||
Html5DashJS.useVideoJSDebug(videojs); | ||
} | ||
// Save the context after the first initialization for subsequent instances | ||
Html5DashJS.context_ = Html5DashJS.context_ || new Dash.di.DashContext(); | ||
Html5DashJS.context_ = Html5DashJS.context_ || {}; | ||
// But make a fresh MediaPlayer each time the sourceHandler is used | ||
this.mediaPlayer_ = new MediaPlayer(Html5DashJS.context_); | ||
this.mediaPlayer_ = dashjs.MediaPlayer(Html5DashJS.context_).create(); | ||
// Log MedaPlayer messages through video.js | ||
if (Html5DashJS.useVideoJSDebug) { | ||
Html5DashJS.useVideoJSDebug(this.mediaPlayer_); | ||
} | ||
// Must run controller before these two lines or else there is no | ||
// element to bind to. | ||
this.mediaPlayer_.startup(); | ||
this.mediaPlayer_.initialize(); | ||
this.mediaPlayer_.attachView(this.el_); | ||
@@ -118,3 +117,4 @@ | ||
// Attach the source with any protection data | ||
this.mediaPlayer_.attachSource(manifest, null, this.keySystemOptions_); | ||
this.mediaPlayer_.setProtectionData(this.keySystemOptions_); | ||
this.mediaPlayer_.attachSource(manifest); | ||
@@ -151,3 +151,3 @@ this.tech_.triggerReady(); | ||
* | ||
* Also rename 'licenseUrl' property in the options to an 'laURL' property | ||
* Also rename 'licenseUrl' property in the options to an 'serverURL' property | ||
*/ | ||
@@ -170,3 +170,3 @@ Html5DashJS.buildDashJSProtData = function (keySystemOptions) { | ||
if (options.licenseUrl) { | ||
options.laURL = options.licenseUrl; | ||
options.serverURL = options.licenseUrl; | ||
delete options.licenseUrl; | ||
@@ -209,10 +209,8 @@ } | ||
// Only add the SourceHandler if the browser supports MediaSourceExtensions | ||
if (!!window.MediaSource) { | ||
videojs.getComponent('Html5').registerSourceHandler({ | ||
videojs.DashSourceHandler = function() { | ||
return { | ||
canHandleSource: function (source) { | ||
var dashTypeRE = /^application\/dash\+xml/i; | ||
var dashExtRE = /\.mpd/i; | ||
if (dashTypeRE.test(source.type)) { | ||
if (videojs.DashSourceHandler.canPlayType(source.type)) { | ||
return 'probably'; | ||
@@ -228,7 +226,25 @@ } else if (dashExtRE.test(source.src)){ | ||
return new Html5DashJS(source, tech); | ||
}, | ||
canPlayType: function (type) { | ||
return videojs.DashSourceHandler.canPlayType(type); | ||
} | ||
}, 0); | ||
}; | ||
}; | ||
videojs.DashSourceHandler.canPlayType = function (type) { | ||
var dashTypeRE = /^application\/dash\+xml/i; | ||
if (dashTypeRE.test(type)) { | ||
return 'probably'; | ||
} | ||
return ''; | ||
}; | ||
// Only add the SourceHandler if the browser supports MediaSourceExtensions | ||
if (!!window.MediaSource) { | ||
videojs.getComponent('Html5').registerSourceHandler(videojs.DashSourceHandler(), 0); | ||
} | ||
videojs.Html5DashJS = Html5DashJS; | ||
})(window, window.videojs); | ||
})(window, window.videojs, window.dashjs); |
@@ -1,3 +0,3 @@ | ||
/*! videojs-contrib-dash - v2.0.0 - 2015-10-16 | ||
* 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&&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.getComponent("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)}},0),b.Html5DashJS=c}(window,window.videojs); | ||
/*! videojs-contrib-dash - v2.1.0 - 2016-03-08 | ||
* Copyright (c) 2016 Brightcove */ | ||
!function(a,b,c){"use strict";function d(a,e){var f,g=e.options_;this.tech_=e,this.el_=e.el(),this.elParent_=this.el_.parentNode,a.src&&(e.isReady_=!1,f=a.src,this.keySystemOptions_=d.buildDashJSProtData(a.keySystemOptions),d.hideErrors(this.elParent_),d.context_=d.context_||{},this.mediaPlayer_=c.MediaPlayer(d.context_).create(),d.useVideoJSDebug&&d.useVideoJSDebug(this.mediaPlayer_),this.mediaPlayer_.initialize(),this.mediaPlayer_.attachView(this.el_),g.autoplay||this.mediaPlayer_.setAutoPlay(!1),this.mediaPlayer_.retrieveManifest(f,b.bind(this,this.initializeDashJS)))}var e=function(a){return"[object Array]"===Object.prototype.toString.call(a)},f=function(a){return"[object Object]"===Object.prototype.toString.call(a)},g=function(a,b){var c,d,e,h;h={};for(c in b)b.hasOwnProperty(c)&&(d=a[c],e=b[c],f(d)&&f(e)?a[c]=g(d,e):a[c]=b[c]);return a};d.prototype.initializeDashJS=function(a,c){var e={};return c?(d.showErrors(this.elParent_),this.tech_.triggerReady(),void this.dispose()):(d.getWidevineProtectionData&&(e=d.getWidevineProtectionData(a),this.keySystemOptions_=g(this.keySystemOptions_,e)),void this.resetSrc_(b.bind(this,function(){d.showErrors(this.elParent_),this.mediaPlayer_.setProtectionData(this.keySystemOptions_),this.mediaPlayer_.attachSource(a),this.tech_.triggerReady()})))},d.hideErrors=function(a){a.className+=" vjs-dashjs-hide-errors"},d.showErrors=function(a){setTimeout(function(){a.className=a.className.replace(" vjs-dashjs-hide-errors","")},250)},d.buildDashJSProtData=function(a){var b,c,d,f={};if(!a||!e(a))return f;for(d=0;d<a.length;d++)b=a[d],c=g({},b.options),c.licenseUrl&&(c.serverURL=c.licenseUrl,delete c.licenseUrl),f[b.name]=c;return f},d.prototype.resetSrc_=function(a){this.el_&&(this.el_.src="",this.el_.setMediaKeys?this.el_.setMediaKeys(null).then(a,a):a())},d.prototype.dispose=function(){this.mediaPlayer_&&this.mediaPlayer_.reset(),this.resetSrc_(function(){})},b.DashSourceHandler=function(){return{canHandleSource:function(a){var c=/\.mpd/i;return b.DashSourceHandler.canPlayType(a.type)?"probably":c.test(a.src)?"maybe":""},handleSource:function(a,b){return new d(a,b)},canPlayType:function(a){return b.DashSourceHandler.canPlayType(a)}}},b.DashSourceHandler.canPlayType=function(a){var b=/^application\/dash\+xml/i;return b.test(a)?"probably":""},a.MediaSource&&b.getComponent("Html5").registerSourceHandler(b.DashSourceHandler(),0),b.Html5DashJS=d}(window,window.videojs,window.dashjs); |
@@ -68,7 +68,29 @@ 'use strict'; | ||
}, | ||
qunit: { | ||
all: ['test/index.html'] | ||
}, | ||
videojs_automation: { | ||
test: ['test/functional/spec.js'] | ||
karma: { | ||
options: { | ||
configFile: 'test/karma.config.js' | ||
}, | ||
unit: { | ||
options: { | ||
files: [ | ||
'node_modules/video.js/dist/video-js.css', | ||
'node_modules/video.js/dist/video.js', | ||
'node_modules/dashjs/dist/dash.all.debug.js', | ||
'src/js/videojs-dash.js', | ||
'test/globals.test.js', | ||
'test/dashjs.test.js' | ||
] | ||
} | ||
}, | ||
integration: { | ||
options: { | ||
files: [ | ||
'node_modules/video.js/dist/video-js.css', | ||
'node_modules/video.js/dist/video.js', | ||
'node_modules/dashjs/dist/dash.all.debug.js', | ||
'src/js/videojs-dash.js', | ||
'test/integration.test.js' | ||
] | ||
} | ||
} | ||
} | ||
@@ -78,13 +100,6 @@ }); | ||
require('load-grunt-tasks')(grunt); | ||
grunt.loadNpmTasks('videojs-automation'); | ||
grunt.registerTask('test', function() { | ||
if (!process.env.TRAVIS || process.env.TRAVIS_PULL_REQUEST === 'false') { | ||
grunt.task.run(['qunit', 'videojs_automation']); | ||
} else { | ||
grunt.task.run('qunit'); | ||
} | ||
}); | ||
grunt.registerTask('test', 'karma'); | ||
grunt.registerTask('build', ['clean', 'jshint', 'uglify', 'cssmin', 'concat']); | ||
grunt.registerTask('default', ['build', 'test']); | ||
}; |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": { | ||
@@ -29,3 +29,3 @@ "name": "Brightcove" | ||
"devDependencies": { | ||
"dashjs": "git://github.com/Dash-Industry-Forum/dash.js", | ||
"dashjs": "^2.0.0", | ||
"grunt": "~0.4.1", | ||
@@ -37,10 +37,15 @@ "grunt-cli": "^0.1.13", | ||
"grunt-contrib-jshint": "~0.6.0", | ||
"grunt-contrib-qunit": "~0.2.0", | ||
"grunt-contrib-uglify": "~0.2.0", | ||
"grunt-contrib-watch": "~0.4.0", | ||
"grunt-karma": "^0.12.1", | ||
"karma": "^0.13.15", | ||
"karma-browserstack-launcher": "^0.1.9", | ||
"karma-chrome-launcher": "^0.2.2", | ||
"karma-detect-browsers": "^2.0.2", | ||
"karma-firefox-launcher": "^0.1.7", | ||
"karma-qunit": "^0.1.8", | ||
"load-grunt-tasks": "^3.1.0", | ||
"qunitjs": "^1.17.1", | ||
"video.js": "^5.0.0-rc.70", | ||
"videojs-automation": "^0.3.1" | ||
"video.js": "^5.0.0" | ||
} | ||
} |
@@ -20,3 +20,3 @@ # video.js MPEG-DASH Source Handler | ||
<!-- Dash.js --> | ||
<script src="dash.all.js"></script> | ||
<script src="dash.all.min.js"></script> | ||
@@ -23,0 +23,0 @@ <!-- videojs-contrib-dash stylesheet --> |
@@ -1,2 +0,2 @@ | ||
(function(window, videojs) { | ||
(function(window, videojs, dashjs) { | ||
'use strict'; | ||
@@ -65,17 +65,16 @@ | ||
// Must be before anything is initialized since we are overridding a global object | ||
// injection | ||
if (Html5DashJS.useVideoJSDebug) { | ||
Html5DashJS.useVideoJSDebug(videojs); | ||
} | ||
// Save the context after the first initialization for subsequent instances | ||
Html5DashJS.context_ = Html5DashJS.context_ || new Dash.di.DashContext(); | ||
Html5DashJS.context_ = Html5DashJS.context_ || {}; | ||
// But make a fresh MediaPlayer each time the sourceHandler is used | ||
this.mediaPlayer_ = new MediaPlayer(Html5DashJS.context_); | ||
this.mediaPlayer_ = dashjs.MediaPlayer(Html5DashJS.context_).create(); | ||
// Log MedaPlayer messages through video.js | ||
if (Html5DashJS.useVideoJSDebug) { | ||
Html5DashJS.useVideoJSDebug(this.mediaPlayer_); | ||
} | ||
// Must run controller before these two lines or else there is no | ||
// element to bind to. | ||
this.mediaPlayer_.startup(); | ||
this.mediaPlayer_.initialize(); | ||
this.mediaPlayer_.attachView(this.el_); | ||
@@ -116,3 +115,4 @@ | ||
// Attach the source with any protection data | ||
this.mediaPlayer_.attachSource(manifest, null, this.keySystemOptions_); | ||
this.mediaPlayer_.setProtectionData(this.keySystemOptions_); | ||
this.mediaPlayer_.attachSource(manifest); | ||
@@ -149,3 +149,3 @@ this.tech_.triggerReady(); | ||
* | ||
* Also rename 'licenseUrl' property in the options to an 'laURL' property | ||
* Also rename 'licenseUrl' property in the options to an 'serverURL' property | ||
*/ | ||
@@ -168,3 +168,3 @@ Html5DashJS.buildDashJSProtData = function (keySystemOptions) { | ||
if (options.licenseUrl) { | ||
options.laURL = options.licenseUrl; | ||
options.serverURL = options.licenseUrl; | ||
delete options.licenseUrl; | ||
@@ -207,10 +207,8 @@ } | ||
// Only add the SourceHandler if the browser supports MediaSourceExtensions | ||
if (!!window.MediaSource) { | ||
videojs.getComponent('Html5').registerSourceHandler({ | ||
videojs.DashSourceHandler = function() { | ||
return { | ||
canHandleSource: function (source) { | ||
var dashTypeRE = /^application\/dash\+xml/i; | ||
var dashExtRE = /\.mpd/i; | ||
if (dashTypeRE.test(source.type)) { | ||
if (videojs.DashSourceHandler.canPlayType(source.type)) { | ||
return 'probably'; | ||
@@ -226,7 +224,25 @@ } else if (dashExtRE.test(source.src)){ | ||
return new Html5DashJS(source, tech); | ||
}, | ||
canPlayType: function (type) { | ||
return videojs.DashSourceHandler.canPlayType(type); | ||
} | ||
}, 0); | ||
}; | ||
}; | ||
videojs.DashSourceHandler.canPlayType = function (type) { | ||
var dashTypeRE = /^application\/dash\+xml/i; | ||
if (dashTypeRE.test(type)) { | ||
return 'probably'; | ||
} | ||
return ''; | ||
}; | ||
// Only add the SourceHandler if the browser supports MediaSourceExtensions | ||
if (!!window.MediaSource) { | ||
videojs.getComponent('Html5').registerSourceHandler(videojs.DashSourceHandler(), 0); | ||
} | ||
videojs.Html5DashJS = Html5DashJS; | ||
})(window, window.videojs); | ||
})(window, window.videojs, window.dashjs); |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
37300
14
510
0
19