Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "clappr", | ||
"description": "An extensible media player for the web", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"homepage": "https://github.com/clappr/clappr", | ||
@@ -6,0 +6,0 @@ "authors": [ |
{ | ||
"name": "clappr", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "An extensible media player for the web", | ||
@@ -5,0 +5,0 @@ "main": "./dist/clappr.js", |
@@ -40,2 +40,6 @@ // Copyright 2014 Globo.com Player authors. All rights reserved. | ||
get container() { return this.core && this.core.activeContainer } | ||
get playback() { return this.core && this.core.activePlayback } | ||
get attributes() { | ||
@@ -79,3 +83,2 @@ return { | ||
this.persistConfig = this.options.persistConfig | ||
this.container = this.core.activeContainer | ||
this.currentPositionValue = null | ||
@@ -119,3 +122,4 @@ this.currentDurationValue = null | ||
bindEvents() { | ||
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.setContainer) | ||
this.stopListening() | ||
this.listenTo(this.core, Events.CORE_ACTIVE_CONTAINER_CHANGED, this.onActiveContainerChanged) | ||
this.listenTo(this.core, Events.CORE_MOUSE_MOVE, this.show) | ||
@@ -126,6 +130,7 @@ this.listenTo(this.core, Events.CORE_MOUSE_LEAVE, () => this.hide(this.options.hideMediaControlDelay)) | ||
Mediator.on(`${this.options.playerId}:${Events.PLAYER_RESIZE}`, this.playerResize, this) | ||
this.container && this.bindContainerEvents() | ||
this.bindContainerEvents() | ||
} | ||
bindContainerEvents() { | ||
if (!this.container) return | ||
this.listenTo(this.container, Events.CONTAINER_PLAY, this.changeTogglePlay) | ||
@@ -166,11 +171,11 @@ this.listenTo(this.container, Events.CONTAINER_PAUSE, this.changeTogglePlay) | ||
play() { | ||
this.container.play() | ||
this.container && this.container.play() | ||
} | ||
pause() { | ||
this.container.pause() | ||
this.container && this.container.pause() | ||
} | ||
stop() { | ||
this.container.stop() | ||
this.container && this.container.stop() | ||
} | ||
@@ -189,3 +194,3 @@ | ||
onLoadedMetadataOnVideoTag() { | ||
let video = this.container.playback.el | ||
let video = this.playback && this.playback.el | ||
// video.webkitSupportsFullscreen is deprecated but iOS appears to only use this | ||
@@ -339,3 +344,3 @@ // see https://github.com/clappr/clappr/issues/1127 | ||
const setWhenContainerReady = () => { | ||
if (this.container.isReady) { | ||
if (this.container && this.container.isReady) { | ||
this.container.setVolume(value) | ||
@@ -363,9 +368,6 @@ } else { | ||
setContainer(container) { | ||
if (this.container) { | ||
this.stopListening(this.container) | ||
this.fullScreenOnVideoTagSupported = null | ||
} | ||
onActiveContainerChanged() { | ||
this.fullScreenOnVideoTagSupported = null | ||
this.bindEvents() | ||
Mediator.off(`${this.options.playerId}:${Events.PLAYER_RESIZE}`, this.playerResize, this) | ||
this.container = container | ||
// set the new container to match the volume of the last one | ||
@@ -376,4 +378,4 @@ this.setInitialVolume() | ||
this.settingsUpdate() | ||
this.container.trigger(Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.container.isDvrInUse()) | ||
this.container.mediaControlDisabled && this.disable() | ||
this.container && this.container.trigger(Events.CONTAINER_PLAYBACKDVRSTATECHANGED, this.container.isDvrInUse()) | ||
this.container && this.container.mediaControlDisabled && this.disable() | ||
this.trigger(Events.MEDIACONTROL_CONTAINERCHANGED) | ||
@@ -423,3 +425,3 @@ } | ||
this.currentSeekBarPercentage = 100 | ||
if (this.container.getPlaybackType() !== Playback.LIVE || this.container.isDvrInUse()) | ||
if (this.container && (this.container.getPlaybackType() !== Playback.LIVE || this.container.isDvrInUse())) | ||
this.currentSeekBarPercentage = (this.currentPositionValue / this.currentDurationValue) * 100 | ||
@@ -446,3 +448,3 @@ | ||
pos = Math.min(100, Math.max(pos, 0)) | ||
this.container.seekPercentage(pos) | ||
this.container && this.container.seekPercentage(pos) | ||
this.setSeekPercentage(pos) | ||
@@ -481,3 +483,3 @@ return false | ||
this.trigger(Events.MEDIACONTROL_SHOW, this.name) | ||
this.container.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name) | ||
this.container && this.container.trigger(Events.CONTAINER_MEDIACONTROL_SHOW, this.name) | ||
this.$el.removeClass('media-control-hide') | ||
@@ -508,3 +510,3 @@ this.hideId = setTimeout(() => this.hide(), timeout) | ||
this.trigger(Events.MEDIACONTROL_HIDE, this.name) | ||
this.container.trigger(Events.CONTAINER_MEDIACONTROL_HIDE, this.name) | ||
this.container && this.container.trigger(Events.CONTAINER_MEDIACONTROL_HIDE, this.name) | ||
this.$el.addClass('media-control-hide') | ||
@@ -540,3 +542,3 @@ this.hideVolumeBar(0) | ||
getSettings() { | ||
return $.extend(true, {}, this.container.settings) | ||
return $.extend(true, {}, this.container && this.container.settings) | ||
} | ||
@@ -634,3 +636,3 @@ | ||
this.bindKeyAndShow(i, () => { | ||
this.settings.seekEnabled && this.container.seekPercentage(i * 10) | ||
this.settings.seekEnabled && this.container && this.container.seekPercentage(i * 10) | ||
}) | ||
@@ -637,0 +639,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11234931
56339