aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils')
-rw-r--r--shared/extra-utils/socket/socket-io.ts7
-rw-r--r--shared/extra-utils/videos/video-streaming-playlists.ts15
2 files changed, 21 insertions, 1 deletions
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) {
6 }) 6 })
7} 7}
8 8
9function getLiveNotificationSocket (serverUrl: string) {
10 return io(serverUrl + '/live-videos')
11}
12
9// --------------------------------------------------------------------------- 13// ---------------------------------------------------------------------------
10 14
11export { 15export {
12 getUserNotificationSocket 16 getUserNotificationSocket,
17 getLiveNotificationSocket
13} 18}
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 (
41 expect(sha256(res2.body)).to.equal(sha256Server) 41 expect(sha256(res2.body)).to.equal(sha256Server)
42} 42}
43 43
44async function checkResolutionsInMasterPlaylist (playlistUrl: string, resolutions: number[]) {
45 const res = await getPlaylist(playlistUrl)
46
47 const masterPlaylist = res.text
48
49 for (const resolution of resolutions) {
50 const reg = new RegExp(
51 '#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + ',(FRAME-RATE=\\d+,)?CODECS="avc1.64001f,mp4a.40.2"'
52 )
53
54 expect(masterPlaylist).to.match(reg)
55 }
56}
57
44// --------------------------------------------------------------------------- 58// ---------------------------------------------------------------------------
45 59
46export { 60export {
47 getPlaylist, 61 getPlaylist,
48 getSegment, 62 getSegment,
63 checkResolutionsInMasterPlaylist,
49 getSegmentSha256, 64 getSegmentSha256,
50 checkSegmentHash 65 checkSegmentHash
51} 66}