Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!this._container) {
this._pluginError('failed to get Clappr current container')
}
// Ensure plugin configuration has VAST tag
if (!this._tag) {
// Handle content autoplay if no tag
if (!this.options.autoPlay && this._autostart) {
this._container.play()
}
return
}
// Ensure playback is using HTML5 video element if mobile device
if (this._playback.tagName !== 'video' && Browser.isMobile) return
// Ensure browser can play video content. (Avoid to display an ad with nothing after)
if (this._playback.name === 'no_op') return
this.$el.show()
this._$clickOverlay.show()
// Attempt to get poster plugin. (May interfere with media control)
this._posterPlugin = this._container.getPlugin('poster')
// Attempt to capture poster play svg icon
if (this._posterPlugin && this._usePosterIcon) {
let svg = this._posterPlugin.$el.find('svg')
if (svg[0]) {
this._playSvg = svg[0]
}
process.nextTick(() => {
this._enableControls()
this.$el.hide()
// Ensure recycleVideo playback option is enabled with mobile devices (Clappr 0.2.66 or greater)
let playbackOptions = this.core.options.playback || {}
playbackOptions.recycleVideo = Browser.isMobile
// Signal loading video content
this._isLoadingContent = true
setTimeout(() => {
this.core.configure({
playback: playbackOptions,
sources: this.core.options.sources,
autoPlay: true, // Assume playback has user consent
})
}, 100)
})
}