Skip to main content

Video.js Service

A service for interacting with Video.js.

Methods

initVideoJsPlayer

Description

  • Creates a videojs player instance on an HTMLElement.

Return Value: A DIGIDECK Core VideoPlayer instance, which wrappers a video.js Player instance.

Options:

  • element: HTMLElement Element to instantiate videojs on. Must be a video element with a unique id on it.
  • sources: Array DIGIDECK Video sources.
  • options: Object Options for initializing player.

Code Example

this.player = await digideckCore.videoJsService.initVideoJsPlayer(this.videoEl, this.source, {
config: {
controls: controls,
muted: !this.audio,
poster: this.posterImage,
loop: this.loop,
autoplay: false,
fill: this.stretching == 'fill' ? true : false
},
onPlayerReady: () => {}
});