Fix for custom controls

This commit is contained in:
Sam Potts
2018-02-13 00:01:19 +11:00
parent 58c2c52c95
commit 6a9be8d16b
10 changed files with 66 additions and 61 deletions

19
src/js/controls.js vendored
View File

@ -215,7 +215,16 @@ const controls = {
utils.setAttributes(button, attributes);
this.elements.buttons[type] = button;
// We have multiple play buttons
if (type === 'play') {
if (!utils.is.array(this.elements.buttons[type])) {
this.elements.buttons[type] = [];
}
this.elements.buttons[type].push(button);
} else {
this.elements.buttons[type] = button;
}
return button;
},
@ -893,7 +902,6 @@ const controls = {
// Play/Pause button
if (this.config.controls.includes('play')) {
container.appendChild(controls.createButton.call(this, 'play'));
// container.appendChild(controls.createButton.call(this, 'pause'));
}
// Fast forward button
@ -1147,9 +1155,10 @@ const controls = {
// Null by default
let container = null;
this.elements.controls = null;
// HTML passed as the option
if (utils.is.string(this.config.controls)) {
// HTML or Element passed as the option
if (utils.is.string(this.config.controls) || utils.is.element(this.config.controls)) {
container = this.config.controls;
} else if (utils.is.function(this.config.controls)) {
// A custom function to build controls
@ -1193,7 +1202,7 @@ const controls = {
}
// Find the elements if need be
if (utils.is.element(this.elements.controls)) {
if (!utils.is.element(this.elements.controls)) {
utils.findElements.call(this);
}