diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-08 10:18:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:17 +0200 |
commit | 4f2199144e428c16460750305f737b890c1ac322 (patch) | |
tree | a19c5c0f254ab0b32d6c8838af33a1ba260e4877 /server/tests/plugins/plugin-transcoding.ts | |
parent | 2c27e70471120c92e0bc8c8114141fbb31ff98ac (diff) | |
download | PeerTube-4f2199144e428c16460750305f737b890c1ac322.tar.gz PeerTube-4f2199144e428c16460750305f737b890c1ac322.tar.zst PeerTube-4f2199144e428c16460750305f737b890c1ac322.zip |
Introduce live command
Diffstat (limited to 'server/tests/plugins/plugin-transcoding.ts')
-rw-r--r-- | server/tests/plugins/plugin-transcoding.ts | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 71c2adc72..65282419e 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -7,18 +7,15 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server | |||
7 | import { | 7 | import { |
8 | buildServerDirectory, | 8 | buildServerDirectory, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | createLive, | ||
11 | flushAndRunServer, | 10 | flushAndRunServer, |
12 | getVideo, | 11 | getVideo, |
13 | PluginsCommand, | 12 | PluginsCommand, |
14 | sendRTMPStreamInVideo, | ||
15 | ServerInfo, | 13 | ServerInfo, |
16 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
17 | setDefaultVideoChannel, | 15 | setDefaultVideoChannel, |
18 | testFfmpegStreamError, | 16 | testFfmpegStreamError, |
19 | uploadVideoAndGetId, | 17 | uploadVideoAndGetId, |
20 | waitJobs, | 18 | waitJobs |
21 | waitUntilLivePublished | ||
22 | } from '@shared/extra-utils' | 19 | } from '@shared/extra-utils' |
23 | import { VideoDetails, VideoPrivacy } from '@shared/models' | 20 | import { VideoDetails, VideoPrivacy } from '@shared/models' |
24 | 21 | ||
@@ -29,8 +26,9 @@ async function createLiveWrapper (server: ServerInfo) { | |||
29 | privacy: VideoPrivacy.PUBLIC | 26 | privacy: VideoPrivacy.PUBLIC |
30 | } | 27 | } |
31 | 28 | ||
32 | const res = await createLive(server.url, server.accessToken, liveAttributes) | 29 | const { uuid } = await server.liveCommand.createLive({ fields: liveAttributes }) |
33 | return res.body.video.uuid | 30 | |
31 | return uuid | ||
34 | } | 32 | } |
35 | 33 | ||
36 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { | 34 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { |
@@ -171,8 +169,8 @@ describe('Test transcoding plugins', function () { | |||
171 | 169 | ||
172 | const liveVideoId = await createLiveWrapper(server) | 170 | const liveVideoId = await createLiveWrapper(server) |
173 | 171 | ||
174 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 172 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
175 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 173 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
176 | await waitJobs([ server ]) | 174 | await waitJobs([ server ]) |
177 | 175 | ||
178 | await checkLiveFPS(liveVideoId, 'above', 20) | 176 | await checkLiveFPS(liveVideoId, 'above', 20) |
@@ -185,8 +183,8 @@ describe('Test transcoding plugins', function () { | |||
185 | 183 | ||
186 | const liveVideoId = await createLiveWrapper(server) | 184 | const liveVideoId = await createLiveWrapper(server) |
187 | 185 | ||
188 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 186 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
189 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 187 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
190 | await waitJobs([ server ]) | 188 | await waitJobs([ server ]) |
191 | 189 | ||
192 | await checkLiveFPS(liveVideoId, 'below', 12) | 190 | await checkLiveFPS(liveVideoId, 'below', 12) |
@@ -199,8 +197,8 @@ describe('Test transcoding plugins', function () { | |||
199 | 197 | ||
200 | const liveVideoId = await createLiveWrapper(server) | 198 | const liveVideoId = await createLiveWrapper(server) |
201 | 199 | ||
202 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 200 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
203 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 201 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
204 | await waitJobs([ server ]) | 202 | await waitJobs([ server ]) |
205 | 203 | ||
206 | await checkLiveFPS(liveVideoId, 'below', 6) | 204 | await checkLiveFPS(liveVideoId, 'below', 6) |
@@ -213,7 +211,7 @@ describe('Test transcoding plugins', function () { | |||
213 | 211 | ||
214 | const liveVideoId = await createLiveWrapper(server) | 212 | const liveVideoId = await createLiveWrapper(server) |
215 | 213 | ||
216 | const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 214 | const command = await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
217 | await testFfmpegStreamError(command, true) | 215 | await testFfmpegStreamError(command, true) |
218 | }) | 216 | }) |
219 | 217 | ||
@@ -262,8 +260,8 @@ describe('Test transcoding plugins', function () { | |||
262 | 260 | ||
263 | const liveVideoId = await createLiveWrapper(server) | 261 | const liveVideoId = await createLiveWrapper(server) |
264 | 262 | ||
265 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 263 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
266 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 264 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
267 | await waitJobs([ server ]) | 265 | await waitJobs([ server ]) |
268 | 266 | ||
269 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` | 267 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` |