From 6a9be8d16b9fba408f92643471b00f10893032ce Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 13 Feb 2018 00:01:19 +1100 Subject: Fix for custom controls --- src/js/controls.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index ea30acec..5e16b952 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -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); } -- cgit v1.2.3