Skip to content

Commit

Permalink
Merge pull request #43 from clappr/fix-intial-options-merge
Browse files Browse the repository at this point in the history
Player - Fix initial options merge
  • Loading branch information
joaopaulovieira authored Jan 15, 2021
2 parents 8a6a9da + 7d9eb28 commit 7eeb065
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/base/playback/playback.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default class Playback extends UIObject {
* @param {Object} options all the options to change in form of a javascript object
*/
configure(options) {
this._options = $.extend(this._options, options)
this._options = $.extend(true, this._options, options)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/base/ui_object/ui_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export default class UIObject extends BaseObject {
*/
_ensureElement() {
if (!this.el) {
const attrs = $.extend({}, this.attributes)
const attrs = $.extend(true, {}, this.attributes)
if (this.id) attrs.id = this.id
if (this.className) attrs['class'] = this.className
const $el = $(DomRecycler.create(this.tagName)).attr(attrs)
Expand Down
4 changes: 2 additions & 2 deletions src/components/container/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class Container extends UIObject {
this.volume = 100
this.playback = options.playback
this.playerError = playerError
this.settings = $.extend({}, this.playback.settings)
this.settings = $.extend(true, {}, this.playback.settings)
this.isReady = false
this.mediaControlDisabled = false
this.plugins = [this.playback]
Expand Down Expand Up @@ -510,7 +510,7 @@ export default class Container extends UIObject {
* @param {Object} options all the options to change in form of a javascript object
*/
configure(options) {
this._options = $.extend(this._options, options)
this._options = $.extend(true, this._options, options)
this.updateStyle()
this.playback.configure(this.options)
this.trigger(Events.CONTAINER_OPTIONS_CHANGE)
Expand Down
4 changes: 2 additions & 2 deletions src/components/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class Core extends UIObject {
sources = sources && sources.constructor === Array ? sources : [sources]
this.options.sources = sources
this.containers.forEach((container) => container.destroy())
this.containerFactory.options = $.extend(this.options, { sources })
this.containerFactory.options = $.extend(true, this.options, { sources })
this.prepareContainers()
}

Expand Down Expand Up @@ -349,7 +349,7 @@ export default class Core extends UIObject {
* @param {Object} options all the options to change in form of a javascript object
*/
configure(options) {
this._options = $.extend(this._options, options)
this._options = $.extend(true, this._options, options)
this.configureDomRecycler()

const sources = options.source || options.sources
Expand Down
2 changes: 1 addition & 1 deletion src/components/player/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export default class Player extends BaseObject {
includeResetStyle: true,
playback: playbackDefaultOptions
}
this._options = $.extend(defaultOptions, options)
this._options = $.extend(true, defaultOptions, options)
this.options.sources = this._normalizeSources(options)
if (!this.options.chromeless) {
// "allowUserInteraction" cannot be false if not in chromeless mode.
Expand Down
2 changes: 1 addition & 1 deletion src/playbacks/html5_video/html5_video.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default class HTML5Video extends Playback {

}

$.extend(this.el, {
$.extend(true, this.el, {
muted: this.options.mute,
defaultMuted: this.options.mute,
loop: this.options.loop,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export function canAutoPlayMedia(cb, options) {
// Simple element factory with video recycle feature.
export class DomRecycler {
static configure(options) {
this.options = $.extend(this.options, options)
this.options = $.extend(true, this.options, options)
}

static create(name) {
Expand Down

0 comments on commit 7eeb065

Please sign in to comment.