diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-04 15:31:32 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | bd54ad1953ee0484ba90cf5f588f4c282048f368 (patch) | |
tree | 36e84ed92589a8775bc18e1b056f6b8de14bf2bb /shared/extra-utils | |
parent | 68e70a745b2010cd0199864a2addd60d8f99c732 (diff) | |
download | PeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.tar.gz PeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.tar.zst PeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.zip |
Add live notification tests
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/socket/socket-io.ts | 7 | ||||
-rw-r--r-- | shared/extra-utils/videos/video-streaming-playlists.ts | 15 |
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 | ||
9 | function getLiveNotificationSocket (serverUrl: string) { | ||
10 | return io(serverUrl + '/live-videos') | ||
11 | } | ||
12 | |||
9 | // --------------------------------------------------------------------------- | 13 | // --------------------------------------------------------------------------- |
10 | 14 | ||
11 | export { | 15 | export { |
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 | ||
44 | async 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 | ||
46 | export { | 60 | export { |
47 | getPlaylist, | 61 | getPlaylist, |
48 | getSegment, | 62 | getSegment, |
63 | checkResolutionsInMasterPlaylist, | ||
49 | getSegmentSha256, | 64 | getSegmentSha256, |
50 | checkSegmentHash | 65 | checkSegmentHash |
51 | } | 66 | } |