aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/shared/player-options-builder/web-video-options-builder.ts
blob: a3c3c3f27ba466921a861d7384b7cb252245c38e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { PeerTubePlayerLoadOptions, WebVideoPluginOptions } from '../../types'

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

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 || [],

      startTime: this.options.startTime
    }
  }
}