custom source selecting function in options

This commit is contained in:
Kasper Moskwiak 2015-11-10 19:43:04 +01:00
parent 8d943b4a98
commit 9ba742ca0e

View file

@ -71,6 +71,10 @@
if(!isPaused){
this.player_.bigPlayButton.hide();
}
if(typeof customSourcePicker !== 'function' &&
typeof this.options_.customSourcePicker === 'function'){
customSourcePicker = this.options_.customSourcePicker;
}
// Change player source and wait for loadeddata event, then play video
// loadedmetadata doesn't work right now for flash.
// Probably because of https://github.com/videojs/video-js-swf/issues/124
@ -97,7 +101,7 @@
this.label = label;
this.label.innerHTML = options.initialySelectedLabel;
// Sets this.player_, this.options_ and initializes the component
MenuButton.call(this, player, options);
MenuButton.call(this, player, options, settings);
this.controlText('Quality');
if(settings.dynamicLabel){
@ -124,7 +128,8 @@
{
label: key,
src: labels[key],
initialySelected: key === this.options_.initialySelectedLabel
initialySelected: key === this.options_.initialySelectedLabel,
customSourcePicker: this.options_.customSourcePicker
},
onClickUnselectOthers,
this.label));
@ -164,7 +169,7 @@
src = src.sort(compareResolutions);
var groupedSrc = bucketSources(src);
var choosen = chooseSrc(groupedSrc, src);
var menuButton = new ResolutionMenuButton(player, { sources: groupedSrc, initialySelectedLabel: choosen.label , initialySelectedRes: choosen.res }, settings, label);
var menuButton = new ResolutionMenuButton(player, { sources: groupedSrc, initialySelectedLabel: choosen.label , initialySelectedRes: choosen.res , customSourcePicker: settings.cusotomSourcPicker}, settings, label);
menuButton.el().classList.add('vjs-resolution-button');
player.controlBar.resolutionSwitcher = player.controlBar.addChild(menuButton);
return setSourcesSanitized(player, choosen.sources, choosen.label);