Chocobozzz/PeerTube

View on GitHub
client/src/assets/player/shared/player-options-builder/web-video-options-builder.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { PeerTubePlayerLoadOptions, WebVideoPluginOptions } from '../../types'

type ConstructorOptions = Pick<PeerTubePlayerLoadOptions, 'videoFileToken' | 'webVideo' | 'hls'>

export class WebVideoOptionsBuilder {

  constructor (private options: ConstructorOptions) {

  }

  getPluginOptions (): WebVideoPluginOptions {
    return {
      videoFileToken: this.options.videoFileToken,

      videoFiles: this.options.webVideo.videoFiles.length !== 0
        ? this.options.webVideo.videoFiles
        : this.options.hls?.videoFiles || []
    }
  }
}