- async function testVideoResolutions (liveVideoId: string, resolutions: number[]) {
- for (const server of servers) {
- const { data } = await server.videos.list()
- expect(data.find(v => v.uuid === liveVideoId)).to.exist
-
- const video = await server.videos.get({ id: liveVideoId })
-
- expect(video.streamingPlaylists).to.have.lengthOf(1)
-
- const hlsPlaylist = video.streamingPlaylists.find(s => s.type === VideoStreamingPlaylistType.HLS)
- expect(hlsPlaylist).to.exist
-
- // Only finite files are displayed
- expect(hlsPlaylist.files).to.have.lengthOf(0)
-
- await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions })
-
- for (let i = 0; i < resolutions.length; i++) {
- const segmentNum = 3
- const segmentName = `${i}-00000${segmentNum}.ts`
- await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, playlistNumber: i, segment: segmentNum })
-
- const subPlaylist = await servers[0].streamingPlaylists.get({
- url: `${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`
- })
-
- expect(subPlaylist).to.contain(segmentName)
-
- const baseUrlAndPath = servers[0].url + '/static/streaming-playlists/hls'
- await checkLiveSegmentHash({
- server,
- baseUrlSegment: baseUrlAndPath,
- videoUUID: video.uuid,
- segmentName,
- hlsPlaylist
- })
- }
- }
- }
-