mirror of
https://github.com/kmoskwiak/videojs-resolution-switcher.git
synced 2025-10-03 09:49:21 +02:00
custom source selecting function in options
This commit is contained in:
parent
8d943b4a98
commit
9ba742ca0e
1 changed files with 31 additions and 26 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue