1 import { wait } from '@shared/core-utils'
2 import { HttpStatusCode } from '@shared/models'
3 import { unwrapBody, unwrapBodyOrDecodeToJSON, unwrapTextOrDecode } from '../requests'
4 import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 export class StreamingPlaylistsCommand extends AbstractCommand {
8 async get (options: OverrideCommandOptions & {
11 videoFileToken?: string
12 reinjectVideoFileToken?: boolean
14 withRetry?: boolean // default false
17 const { videoFileToken, reinjectVideoFileToken, withRetry, currentRetry = 1 } = options
20 const result = await unwrapTextOrDecode(this.getRawRequest({
26 reinjectVideoFileToken
29 defaultExpectedStatus: HttpStatusCode.OK_200
34 if (!withRetry || currentRetry > 5) throw err
42 currentRetry: currentRetry + 1
47 getFragmentedSegment (options: OverrideCommandOptions & {
51 return unwrapBody<Buffer>(this.getRawRequest({
57 defaultExpectedStatus: HttpStatusCode.OK_200
61 getSegmentSha256 (options: OverrideCommandOptions & {
64 return unwrapBodyOrDecodeToJSON<{ [ id: string ]: string }>(this.getRawRequest({
69 defaultExpectedStatus: HttpStatusCode.OK_200