mirror of
https://github.com/kmoskwiak/videojs-resolution-switcher.git
synced 2025-10-03 09:49:21 +02:00
Move code out from the videoJsResolutionSwitcher function
This commit is contained in:
parent
157cd3b211
commit
800cd83e86
1 changed files with 98 additions and 98 deletions
22
index.js
22
index.js
|
@ -8,17 +8,6 @@
|
|||
var defaults = {},
|
||||
videoJsResolutionSwitcher;
|
||||
|
||||
/**
|
||||
* Initialize the plugin.
|
||||
* @param options (optional) {object} configuration for the plugin
|
||||
*/
|
||||
videoJsResolutionSwitcher = function(options) {
|
||||
var settings = videojs.mergeOptions(defaults, options),
|
||||
player = this,
|
||||
label = document.createElement('span');
|
||||
|
||||
label.classList.add('vjs-resolution-button-label');
|
||||
|
||||
function setSourcesSanitized(player, sources) {
|
||||
return player.src(sources.map(function(src) {
|
||||
return {src: src.src, type: src.type, res: src.res};
|
||||
|
@ -117,6 +106,17 @@
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialize the plugin.
|
||||
* @param options (optional) {object} configuration for the plugin
|
||||
*/
|
||||
videoJsResolutionSwitcher = function(options) {
|
||||
var settings = videojs.mergeOptions(defaults, options),
|
||||
player = this,
|
||||
label = document.createElement('span');
|
||||
|
||||
label.classList.add('vjs-resolution-button-label');
|
||||
|
||||
player.updateSrc = function(src){
|
||||
//Return current src if src is not given
|
||||
if(!src){ return player.src(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue