New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@clappr/core

Package Overview
Dependencies
Maintainers
8
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clappr/core - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

5

package.json
{
"name": "@clappr/core",
"version": "0.5.0",
"version": "0.6.0",
"description": "Core components of the extensible media player for the web",

@@ -22,5 +22,2 @@ "main": "./dist/clappr-core.js",

},
"engines": {
"node": "^v14.0.0"
},
"files": [

@@ -27,0 +24,0 @@ "/dist",

19

src/components/core/core.js

@@ -118,2 +118,3 @@ // Copyright 2014 Globo.com Player authors. All rights reserved.

this.firstResize = true
this.styleRendered = false
this.plugins = []

@@ -371,7 +372,2 @@ this.containers = []

appendToParent() {
const style = Styler.getStyleFor(CoreStyle.toString(), { baseUrl: this.options.baseUrl })
const resetStyle = Styler.getStyleFor(ResetStyle.toString(), { baseUrl: this.options.baseUrl })
this.$el.append(style[0])
this.options.includeResetStyle && this.$el.append(resetStyle[0])
const hasCoreParent = this.$el.parent() && this.$el.parent().length

@@ -381,3 +377,16 @@ !hasCoreParent && this.$el.appendTo(this.options.parentElement)

appendStyles() {
if (this.styleRendered) return
const style = Styler.getStyleFor(CoreStyle.toString(), { baseUrl: this.options.baseUrl })
this.$el.append(style[0])
if (this.options.includeResetStyle) {
const resetStyle = Styler.getStyleFor(ResetStyle.toString(), { baseUrl: this.options.baseUrl })
this.$el.append(resetStyle[0])
}
this.styleRendered = true
}
render() {
this.appendStyles()
this.options.width = this.options.width || this.$el.width()

@@ -384,0 +393,0 @@ this.options.height = this.options.height || this.$el.height()

@@ -288,2 +288,36 @@ import Core from './core'

})
describe('when rendering', () => {
beforeEach(() => {
this.core = new Core({})
})
test('append default style element', () => {
this.core.render()
expect(this.core.el.children.length).toEqual(1)
expect(this.core.el.children[0].tagName).toEqual('STYLE')
})
test('append default and reset style elements with includeResetStyle set', () => {
const newOptions = {
includeResetStyle: true,
}
this.core.configure(newOptions)
this.core.render()
expect(this.core.el.children.length).toEqual(2)
expect(this.core.el.children[0].tagName).toEqual('STYLE')
expect(this.core.el.children[1].tagName).toEqual('STYLE')
})
test('does append style elements twice', () => {
this.core.render()
this.core.render()
expect(this.core.el.children.length).toEqual(1)
expect(this.core.el.children[0].tagName).toEqual('STYLE')
})
})
})

@@ -21,3 +21,3 @@ import Loader from './loader'

beforeEach(() => {
corePlugin = CorePlugin.extend({ name: 'core-plugin', supportedVersion: { min: '0.4.0' } })
corePlugin = CorePlugin.extend({ name: 'core-plugin', supportedVersion: { min: '0.5.0' } })
containerPlugin = ContainerPlugin.extend({ name: 'container-plugin', supportedVersion: { min: '0.4.0', max: '9.9.9' } })

@@ -24,0 +24,0 @@ })

@@ -128,3 +128,5 @@ // Copyright 2014 Globo.com Player authors. All rights reserved.

this._ccTrackId = -1
this._playheadMovingCheckEnabled = !this.options.disablePlayheadMovingCheck
this._setupSrc(this.options.src)
this._playheadMovingCheckInterval = this.options.playheadMovingCheckInterval || 500
// backwards compatibility (TODO: remove on 0.3.0)

@@ -376,3 +378,3 @@ this.options.playback || (this.options.playback = this.options || {})

_startPlayheadMovingChecks() {
if (this._playheadMovingTimer !== null)
if (this._playheadMovingTimer !== null && !this._playheadMovingCheckEnabled)
return

@@ -382,3 +384,3 @@

this._determineIfPlayheadMoving()
this._playheadMovingTimer = setInterval(this._determineIfPlayheadMoving.bind(this), 500)
this._playheadMovingTimer = setInterval(this._determineIfPlayheadMoving.bind(this), this._playheadMovingCheckInterval)
}

@@ -467,4 +469,8 @@

_handleBufferingEvents() {
const playheadShouldBeMoving = !this.el.ended && !this.el.paused
const buffering = this._loadStarted && !this.el.ended && !this._stopped && ((playheadShouldBeMoving && !this._playheadMoving) || this.el.readyState < this.el.HAVE_FUTURE_DATA)
const isLoading = this._loadStarted && !this.el.ended && !this._stopped
const isMissingMediaDataToPlay = this.el.readyState < this.el.HAVE_FUTURE_DATA
const playheadShouldBeMoving = !this.el.ended && !this.el.paused && !this._playheadMoving
let buffering = isLoading && isMissingMediaDataToPlay
if (this._playheadMovingCheckEnabled) buffering = buffering || isLoading && playheadShouldBeMoving
if (this._isBuffering !== buffering) {

@@ -476,3 +482,2 @@ this._isBuffering = buffering

this.trigger(Events.PLAYBACK_BUFFERFULL, this.name)
}

@@ -501,2 +506,3 @@ }

this.handleTextTrackChange && this.el.textTracks.removeEventListener('change', this.handleTextTrackChange)
this.$el.off('contextmenu')
super.destroy()

@@ -704,3 +710,3 @@ this.el.removeAttribute('src')

HTML5Video._mimeTypesForUrl = function(resourceUrl, mimeTypesByExtension, mimeType) {
HTML5Video._mimeTypesForUrl = function(resourceUrl = '', mimeTypesByExtension, mimeType) {
const extension = (resourceUrl.split('?')[0].match(/.*\.(.*)$/) || [])[1]

@@ -707,0 +713,0 @@ let mimeTypes = mimeType || (extension && mimeTypesByExtension[extension.toLowerCase()]) || []

@@ -12,2 +12,3 @@ import HTML5Video from './html5_video'

test('checks if it can play a resource', () => {
expect(HTML5Video.canPlay()).toBeFalsy()
expect(HTML5Video.canPlay('')).toBeFalsy()

@@ -14,0 +15,0 @@ expect(HTML5Video.canPlay('resource_without_dots')).toBeFalsy()

@@ -57,3 +57,3 @@ import { getBrowserLanguage } from '../../utils'

'disabled': 'Desativado',
'playback_not_supported': 'Seu navegador não supporta a reprodução deste video. Por favor, tente usar um navegador diferente.',
'playback_not_supported': 'Seu navegador não suporta a reprodução deste video. Por favor, tente usar um navegador diferente.',
'default_error_title': 'Não foi possível reproduzir o vídeo.',

@@ -60,0 +60,0 @@ 'default_error_message': 'Ocorreu um problema ao tentar carregar o vídeo.',

Sorry, the diff of this file is too big to display

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc