aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/streaming-playlists.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/shared/streaming-playlists.ts')
-rw-r--r--server/tests/shared/streaming-playlists.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/server/tests/shared/streaming-playlists.ts b/server/tests/shared/streaming-playlists.ts
index 4d82b3654..74c25e99c 100644
--- a/server/tests/shared/streaming-playlists.ts
+++ b/server/tests/shared/streaming-playlists.ts
@@ -26,7 +26,7 @@ async function checkSegmentHash (options: {
26 const offset = parseInt(matches[2], 10) 26 const offset = parseInt(matches[2], 10)
27 const range = `${offset}-${offset + length - 1}` 27 const range = `${offset}-${offset + length - 1}`
28 28
29 const segmentBody = await command.getSegment({ 29 const segmentBody = await command.getFragmentedSegment({
30 url: `${baseUrlSegment}/${videoName}`, 30 url: `${baseUrlSegment}/${videoName}`,
31 expectedStatus: HttpStatusCode.PARTIAL_CONTENT_206, 31 expectedStatus: HttpStatusCode.PARTIAL_CONTENT_206,
32 range: `bytes=${range}` 32 range: `bytes=${range}`
@@ -46,7 +46,7 @@ async function checkLiveSegmentHash (options: {
46 const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options 46 const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options
47 const command = server.streamingPlaylists 47 const command = server.streamingPlaylists
48 48
49 const segmentBody = await command.getSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` }) 49 const segmentBody = await command.getFragmentedSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` })
50 const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url }) 50 const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url })
51 51
52 expect(sha256(segmentBody)).to.equal(shaBody[segmentName]) 52 expect(sha256(segmentBody)).to.equal(shaBody[segmentName])
@@ -56,15 +56,17 @@ async function checkResolutionsInMasterPlaylist (options: {
56 server: PeerTubeServer 56 server: PeerTubeServer
57 playlistUrl: string 57 playlistUrl: string
58 resolutions: number[] 58 resolutions: number[]
59 transcoded?: boolean // default true
60 withRetry?: boolean // default false
59}) { 61}) {
60 const { server, playlistUrl, resolutions } = options 62 const { server, playlistUrl, resolutions, withRetry = false, transcoded = true } = options
61 63
62 const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl }) 64 const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl, withRetry })
63 65
64 for (const resolution of resolutions) { 66 for (const resolution of resolutions) {
65 const reg = new RegExp( 67 const reg = transcoded
66 '#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + ',(FRAME-RATE=\\d+,)?CODECS="avc1.64001f,mp4a.40.2"' 68 ? new RegExp('#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + ',(FRAME-RATE=\\d+,)?CODECS="avc1.64001f,mp4a.40.2"')
67 ) 69 : new RegExp('#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + '')
68 70
69 expect(masterPlaylist).to.match(reg) 71 expect(masterPlaylist).to.match(reg)
70 } 72 }