diff options
Diffstat (limited to 'shared/extra-utils/videos/video-streaming-playlists.ts')
-rw-r--r-- | shared/extra-utils/videos/video-streaming-playlists.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/shared/extra-utils/videos/video-streaming-playlists.ts b/shared/extra-utils/videos/video-streaming-playlists.ts index b386e77c3..99c2e1880 100644 --- a/shared/extra-utils/videos/video-streaming-playlists.ts +++ b/shared/extra-utils/videos/video-streaming-playlists.ts | |||
@@ -2,16 +2,17 @@ import { makeRawRequest } from '../requests/requests' | |||
2 | import { sha256 } from '../../../server/helpers/core-utils' | 2 | import { sha256 } from '../../../server/helpers/core-utils' |
3 | import { VideoStreamingPlaylist } from '../../models/videos/video-streaming-playlist.model' | 3 | import { VideoStreamingPlaylist } from '../../models/videos/video-streaming-playlist.model' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
5 | 6 | ||
6 | function getPlaylist (url: string, statusCodeExpected = 200) { | 7 | function getPlaylist (url: string, statusCodeExpected = HttpStatusCode.OK_200) { |
7 | return makeRawRequest(url, statusCodeExpected) | 8 | return makeRawRequest(url, statusCodeExpected) |
8 | } | 9 | } |
9 | 10 | ||
10 | function getSegment (url: string, statusCodeExpected = 200, range?: string) { | 11 | function getSegment (url: string, statusCodeExpected = HttpStatusCode.OK_200, range?: string) { |
11 | return makeRawRequest(url, statusCodeExpected, range) | 12 | return makeRawRequest(url, statusCodeExpected, range) |
12 | } | 13 | } |
13 | 14 | ||
14 | function getSegmentSha256 (url: string, statusCodeExpected = 200) { | 15 | function getSegmentSha256 (url: string, statusCodeExpected = HttpStatusCode.OK_200) { |
15 | return makeRawRequest(url, statusCodeExpected) | 16 | return makeRawRequest(url, statusCodeExpected) |
16 | } | 17 | } |
17 | 18 | ||
@@ -33,7 +34,7 @@ async function checkSegmentHash ( | |||
33 | const offset = parseInt(matches[2], 10) | 34 | const offset = parseInt(matches[2], 10) |
34 | const range = `${offset}-${offset + length - 1}` | 35 | const range = `${offset}-${offset + length - 1}` |
35 | 36 | ||
36 | const res2 = await getSegment(`${baseUrlSegment}/${videoUUID}/${videoName}`, 206, `bytes=${range}`) | 37 | const res2 = await getSegment(`${baseUrlSegment}/${videoUUID}/${videoName}`, HttpStatusCode.PARTIAL_CONTENT_206, `bytes=${range}`) |
37 | 38 | ||
38 | const resSha = await getSegmentSha256(hlsPlaylist.segmentsSha256Url) | 39 | const resSha = await getSegmentSha256(hlsPlaylist.segmentsSha256Url) |
39 | 40 | ||