+ await testVideoResolutions(liveVideoId, resolutions)
+
+ await stopFfmpeg(ffmpegCommand)
+ await commands[0].waitUntilEnded({ videoId: liveVideoId })
+
+ await waitJobs(servers)
+
+ await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
+
+ const bitrateLimits = {
+ 720: 5000 * 1000, // 60FPS
+ 360: 1100 * 1000,
+ 240: 600 * 1000
+ }
+
+ for (const server of servers) {
+ const video = await server.videos.get({ id: liveVideoId })
+
+ expect(video.state.id).to.equal(VideoState.PUBLISHED)
+ expect(video.duration).to.be.greaterThan(1)
+ expect(video.files).to.have.lengthOf(0)
+
+ const hlsPlaylist = video.streamingPlaylists.find(s => s.type === VideoStreamingPlaylistType.HLS)
+ await makeRawRequest(hlsPlaylist.playlistUrl, HttpStatusCode.OK_200)
+ await makeRawRequest(hlsPlaylist.segmentsSha256Url, HttpStatusCode.OK_200)
+
+ expect(hlsPlaylist.files).to.have.lengthOf(resolutions.length)
+
+ for (const resolution of resolutions) {
+ const file = hlsPlaylist.files.find(f => f.resolution.id === resolution)
+
+ expect(file).to.exist
+ expect(file.size).to.be.greaterThan(1)
+
+ if (resolution >= 720) {
+ expect(file.fps).to.be.approximately(60, 2)
+ } else {
+ expect(file.fps).to.be.approximately(30, 2)
+ }
+
+ const filename = `${video.uuid}-${resolution}-fragmented.mp4`
+ const segmentPath = servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename))
+
+ const probe = await ffprobePromise(segmentPath)
+ const videoStream = await getVideoStreamFromFile(segmentPath, probe)
+
+ expect(probe.format.bit_rate).to.be.below(bitrateLimits[videoStream.height])
+
+ await makeRawRequest(file.torrentUrl, HttpStatusCode.OK_200)
+ await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200)
+ }
+ }