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/socket/socket-io.ts | 7 ++++++- shared/extra-utils/videos/video-streaming-playlists.ts | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'shared/extra-utils') diff --git a/shared/extra-utils/socket/socket-io.ts b/shared/extra-utils/socket/socket-io.ts index 854ab71af..66099464f 100644 --- a/shared/extra-utils/socket/socket-io.ts +++ b/shared/extra-utils/socket/socket-io.ts @@ -6,8 +6,13 @@ function getUserNotificationSocket (serverUrl: string, accessToken: string) { }) } +function getLiveNotificationSocket (serverUrl: string) { + return io(serverUrl + '/live-videos') +} + // --------------------------------------------------------------------------- export { - getUserNotificationSocket + getUserNotificationSocket, + getLiveNotificationSocket } 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