From bd54ad1953ee0484ba90cf5f588f4c282048f368 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 Nov 2020 15:31:32 +0100 Subject: Add live notification tests --- shared/extra-utils/videos/video-streaming-playlists.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'shared/extra-utils/videos') diff --git a/shared/extra-utils/videos/video-streaming-playlists.ts b/shared/extra-utils/videos/video-streaming-playlists.ts index e54da84aa..8cf0e4930 100644 --- a/shared/extra-utils/videos/video-streaming-playlists.ts +++ b/shared/extra-utils/videos/video-streaming-playlists.ts @@ -41,11 +41,26 @@ async function checkSegmentHash ( expect(sha256(res2.body)).to.equal(sha256Server) } +async function checkResolutionsInMasterPlaylist (playlistUrl: string, resolutions: number[]) { + const res = await getPlaylist(playlistUrl) + + const masterPlaylist = res.text + + for (const resolution of resolutions) { + const reg = new RegExp( + '#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + ',(FRAME-RATE=\\d+,)?CODECS="avc1.64001f,mp4a.40.2"' + ) + + expect(masterPlaylist).to.match(reg) + } +} + // --------------------------------------------------------------------------- export { getPlaylist, getSegment, + checkResolutionsInMasterPlaylist, getSegmentSha256, checkSegmentHash } -- cgit v1.2.3