Manually merged PR #1607
This commit is contained in:
parent
ff105ee203
commit
6ffaef35cf
@ -70,6 +70,8 @@ const defaults = {
|
|||||||
quality: {
|
quality: {
|
||||||
default: 576,
|
default: 576,
|
||||||
options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
|
options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
|
||||||
|
forced: false,
|
||||||
|
onChange: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set loops
|
// Set loops
|
||||||
|
@ -30,6 +30,11 @@ const html5 = {
|
|||||||
|
|
||||||
// Get quality levels
|
// Get quality levels
|
||||||
getQualityOptions() {
|
getQualityOptions() {
|
||||||
|
// Whether we're forcing all options (e.g. for streaming)
|
||||||
|
if (this.config.quality.forced) {
|
||||||
|
return this.config.quality.options;
|
||||||
|
}
|
||||||
|
|
||||||
// Get sizes from <source> elements
|
// Get sizes from <source> elements
|
||||||
return html5.getSources
|
return html5.getSources
|
||||||
.call(this)
|
.call(this)
|
||||||
@ -60,6 +65,10 @@ const html5 = {
|
|||||||
return source && Number(source.getAttribute('size'));
|
return source && Number(source.getAttribute('size'));
|
||||||
},
|
},
|
||||||
set(input) {
|
set(input) {
|
||||||
|
// If we're using an an external handler...
|
||||||
|
if (player.config.quality.forced && is.function(player.config.quality.onChange)) {
|
||||||
|
player.config.quality.onChange(input);
|
||||||
|
} else {
|
||||||
// Get sources
|
// Get sources
|
||||||
const sources = html5.getSources.call(player);
|
const sources = html5.getSources.call(player);
|
||||||
// Get first match for requested size
|
// Get first match for requested size
|
||||||
@ -91,6 +100,7 @@ const html5 = {
|
|||||||
// Load new source
|
// Load new source
|
||||||
player.media.load();
|
player.media.load();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Trigger change event
|
// Trigger change event
|
||||||
triggerEvent.call(player, player.media, 'qualitychange', false, {
|
triggerEvent.call(player, player.media, 'qualitychange', false, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user