Shorter live methods
This commit is contained in:
parent
d897210c2d
commit
04aed76711
14 changed files with 96 additions and 96 deletions
|
@ -337,72 +337,72 @@ describe('Test video lives API validator', function () {
|
|||
describe('When getting live information', function () {
|
||||
|
||||
it('Should fail without access token', async function () {
|
||||
await command.getLive({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
await command.get({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
})
|
||||
|
||||
it('Should fail with a bad access token', async function () {
|
||||
await command.getLive({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
await command.get({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
})
|
||||
|
||||
it('Should fail with access token of another user', async function () {
|
||||
await command.getLive({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
await command.get({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
})
|
||||
|
||||
it('Should fail with a bad video id', async function () {
|
||||
await command.getLive({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await command.get({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
})
|
||||
|
||||
it('Should fail with an unknown video id', async function () {
|
||||
await command.getLive({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
await command.get({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
})
|
||||
|
||||
it('Should fail with a non live video', async function () {
|
||||
await command.getLive({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
await command.get({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
})
|
||||
|
||||
it('Should succeed with the correct params', async function () {
|
||||
await command.getLive({ videoId: video.id })
|
||||
await command.getLive({ videoId: video.uuid })
|
||||
await command.getLive({ videoId: video.shortUUID })
|
||||
await command.get({ videoId: video.id })
|
||||
await command.get({ videoId: video.uuid })
|
||||
await command.get({ videoId: video.shortUUID })
|
||||
})
|
||||
})
|
||||
|
||||
describe('When updating live information', async function () {
|
||||
|
||||
it('Should fail without access token', async function () {
|
||||
await command.updateLive({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
await command.update({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
})
|
||||
|
||||
it('Should fail with a bad access token', async function () {
|
||||
await command.updateLive({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
await command.update({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
|
||||
})
|
||||
|
||||
it('Should fail with access token of another user', async function () {
|
||||
await command.updateLive({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
await command.update({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
})
|
||||
|
||||
it('Should fail with a bad video id', async function () {
|
||||
await command.updateLive({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await command.update({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
})
|
||||
|
||||
it('Should fail with an unknown video id', async function () {
|
||||
await command.updateLive({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
await command.update({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
})
|
||||
|
||||
it('Should fail with a non live video', async function () {
|
||||
await command.updateLive({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
await command.update({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
})
|
||||
|
||||
it('Should fail with save replay and permanent live set to true', async function () {
|
||||
const fields = { saveReplay: true, permanentLive: true }
|
||||
|
||||
await command.updateLive({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
})
|
||||
|
||||
it('Should succeed with the correct params', async function () {
|
||||
await command.updateLive({ videoId: video.id, fields: { saveReplay: false } })
|
||||
await command.updateLive({ videoId: video.uuid, fields: { saveReplay: false } })
|
||||
await command.updateLive({ videoId: video.shortUUID, fields: { saveReplay: false } })
|
||||
await command.update({ videoId: video.id, fields: { saveReplay: false } })
|
||||
await command.update({ videoId: video.uuid, fields: { saveReplay: false } })
|
||||
await command.update({ videoId: video.shortUUID, fields: { saveReplay: false } })
|
||||
})
|
||||
|
||||
it('Should fail to update replay status if replay is not allowed on the instance', async function () {
|
||||
|
@ -415,18 +415,18 @@ describe('Test video lives API validator', function () {
|
|||
}
|
||||
})
|
||||
|
||||
await command.updateLive({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
await command.update({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
})
|
||||
|
||||
it('Should fail to update a live if it has already started', async function () {
|
||||
this.timeout(40000)
|
||||
|
||||
const live = await command.getLive({ videoId: video.id })
|
||||
const live = await command.get({ videoId: video.id })
|
||||
|
||||
const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey)
|
||||
|
||||
await command.waitUntilLivePublished({ videoId: video.id })
|
||||
await command.updateLive({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
await command.waitUntilPublished({ videoId: video.id })
|
||||
await command.update({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
|
||||
|
||||
await stopFfmpeg(ffmpegCommand)
|
||||
})
|
||||
|
@ -434,13 +434,13 @@ describe('Test video lives API validator', function () {
|
|||
it('Should fail to stream twice in the save live', async function () {
|
||||
this.timeout(40000)
|
||||
|
||||
const live = await command.getLive({ videoId: video.id })
|
||||
const live = await command.get({ videoId: video.id })
|
||||
|
||||
const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey)
|
||||
|
||||
await command.waitUntilLivePublished({ videoId: video.id })
|
||||
await command.waitUntilPublished({ videoId: video.id })
|
||||
|
||||
await command.runAndTestFfmpegStreamError({ videoId: video.id, shouldHaveError: true })
|
||||
await command.runAndTestStreamError({ videoId: video.id, shouldHaveError: true })
|
||||
|
||||
await stopFfmpeg(ffmpegCommand)
|
||||
})
|
||||
|
|
|
@ -35,7 +35,7 @@ describe('Test live constraints', function () {
|
|||
saveReplay
|
||||
}
|
||||
|
||||
const { uuid } = await servers[0].liveCommand.createLive({ token: userAccessToken, fields: liveAttributes })
|
||||
const { uuid } = await servers[0].liveCommand.create({ token: userAccessToken, fields: liveAttributes })
|
||||
return uuid
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ describe('Test live constraints', function () {
|
|||
|
||||
async function waitUntilLivePublishedOnAllServers (videoId: string) {
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId })
|
||||
await server.liveCommand.waitUntilPublished({ videoId })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ describe('Test live constraints', function () {
|
|||
this.timeout(60000)
|
||||
|
||||
const userVideoLiveoId = await createLiveWrapper(false)
|
||||
await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
|
||||
await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
|
||||
})
|
||||
|
||||
it('Should have size limit depending on user global quota if save replay is enabled', async function () {
|
||||
|
@ -115,7 +115,7 @@ describe('Test live constraints', function () {
|
|||
await wait(5000)
|
||||
|
||||
const userVideoLiveoId = await createLiveWrapper(true)
|
||||
await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
|
||||
await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
|
||||
|
||||
await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
|
||||
await waitJobs(servers)
|
||||
|
@ -132,7 +132,7 @@ describe('Test live constraints', function () {
|
|||
await updateQuota({ total: -1, daily: 1 })
|
||||
|
||||
const userVideoLiveoId = await createLiveWrapper(true)
|
||||
await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
|
||||
await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
|
||||
|
||||
await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
|
||||
await waitJobs(servers)
|
||||
|
@ -149,7 +149,7 @@ describe('Test live constraints', function () {
|
|||
await updateQuota({ total: 10 * 1000 * 1000, daily: -1 })
|
||||
|
||||
const userVideoLiveoId = await createLiveWrapper(true)
|
||||
await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
|
||||
await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
|
||||
})
|
||||
|
||||
it('Should have max duration limit', async function () {
|
||||
|
@ -170,7 +170,7 @@ describe('Test live constraints', function () {
|
|||
})
|
||||
|
||||
const userVideoLiveoId = await createLiveWrapper(true)
|
||||
await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
|
||||
await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
|
||||
|
||||
await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
|
||||
await waitJobs(servers)
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('Permanent live', function () {
|
|||
permanentLive
|
||||
}
|
||||
|
||||
const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes })
|
||||
const { uuid } = await servers[0].liveCommand.create({ fields: attributes })
|
||||
return uuid
|
||||
}
|
||||
|
||||
|
@ -76,14 +76,14 @@ describe('Permanent live', function () {
|
|||
const videoUUID = await createLiveWrapper(false)
|
||||
|
||||
{
|
||||
const live = await servers[0].liveCommand.getLive({ videoId: videoUUID })
|
||||
const live = await servers[0].liveCommand.get({ videoId: videoUUID })
|
||||
expect(live.permanentLive).to.be.false
|
||||
}
|
||||
|
||||
await servers[0].liveCommand.updateLive({ videoId: videoUUID, fields: { permanentLive: true } })
|
||||
await servers[0].liveCommand.update({ videoId: videoUUID, fields: { permanentLive: true } })
|
||||
|
||||
{
|
||||
const live = await servers[0].liveCommand.getLive({ videoId: videoUUID })
|
||||
const live = await servers[0].liveCommand.get({ videoId: videoUUID })
|
||||
expect(live.permanentLive).to.be.true
|
||||
}
|
||||
})
|
||||
|
@ -93,7 +93,7 @@ describe('Permanent live', function () {
|
|||
|
||||
videoUUID = await createLiveWrapper(true)
|
||||
|
||||
const live = await servers[0].liveCommand.getLive({ videoId: videoUUID })
|
||||
const live = await servers[0].liveCommand.get({ videoId: videoUUID })
|
||||
expect(live.permanentLive).to.be.true
|
||||
|
||||
await waitJobs(servers)
|
||||
|
@ -105,13 +105,13 @@ describe('Permanent live', function () {
|
|||
const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID })
|
||||
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID })
|
||||
await server.liveCommand.waitUntilPublished({ videoId: videoUUID })
|
||||
}
|
||||
|
||||
await checkVideoState(videoUUID, VideoState.PUBLISHED)
|
||||
|
||||
await stopFfmpeg(ffmpegCommand)
|
||||
await servers[0].liveCommand.waitUntilLiveWaiting({ videoId: videoUUID })
|
||||
await servers[0].liveCommand.waitUntilWaiting({ videoId: videoUUID })
|
||||
|
||||
await waitJobs(servers)
|
||||
})
|
||||
|
@ -156,12 +156,12 @@ describe('Permanent live', function () {
|
|||
const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID })
|
||||
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID })
|
||||
await server.liveCommand.waitUntilPublished({ videoId: videoUUID })
|
||||
}
|
||||
|
||||
await checkVideoState(videoUUID, VideoState.PUBLISHED)
|
||||
|
||||
const count = await servers[0].liveCommand.getPlaylistsCount({ videoUUID })
|
||||
const count = await servers[0].liveCommand.countPlaylists({ videoUUID })
|
||||
// master playlist and 720p playlist
|
||||
expect(count).to.equal(2)
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ describe('Save replay setting', function () {
|
|||
saveReplay
|
||||
}
|
||||
|
||||
const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes })
|
||||
const { uuid } = await servers[0].liveCommand.create({ fields: attributes })
|
||||
return uuid
|
||||
}
|
||||
|
||||
|
@ -74,13 +74,13 @@ describe('Save replay setting', function () {
|
|||
|
||||
async function waitUntilLivePublishedOnAllServers (videoId: string) {
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId })
|
||||
await server.liveCommand.waitUntilPublished({ videoId })
|
||||
}
|
||||
}
|
||||
|
||||
async function waitUntilLiveSavedOnAllServers (videoId: string) {
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLiveSaved({ videoId })
|
||||
await server.liveCommand.waitUntilSaved({ videoId })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ describe('Save replay setting', function () {
|
|||
await stopFfmpeg(ffmpegCommand)
|
||||
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID })
|
||||
await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID })
|
||||
}
|
||||
await waitJobs(servers)
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ describe('Test live', function () {
|
|||
privacy: VideoPrivacy.PUBLIC
|
||||
}
|
||||
|
||||
const { uuid } = await servers[0].liveCommand.createLive({ fields: liveAttributes })
|
||||
const { uuid } = await servers[0].liveCommand.create({ fields: liveAttributes })
|
||||
return uuid
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ describe('Test live', function () {
|
|||
await stopFfmpeg(ffmpegCommand)
|
||||
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID })
|
||||
await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID })
|
||||
}
|
||||
await waitJobs(servers)
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ describe('Test live', function () {
|
|||
privacy: VideoPrivacy.PUBLIC
|
||||
}
|
||||
|
||||
const live = await servers[0].liveCommand.createLive({ fields: liveAttributes })
|
||||
const live = await servers[0].liveCommand.create({ fields: liveAttributes })
|
||||
liveVideoId = live.uuid
|
||||
|
||||
command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId })
|
||||
|
|
|
@ -96,7 +96,7 @@ describe('Test live', function () {
|
|||
thumbnailfile: 'video_short1.webm.jpg'
|
||||
}
|
||||
|
||||
const live = await commands[0].createLive({ fields: attributes })
|
||||
const live = await commands[0].create({ fields: attributes })
|
||||
liveVideoUUID = live.uuid
|
||||
|
||||
await waitJobs(servers)
|
||||
|
@ -127,7 +127,7 @@ describe('Test live', function () {
|
|||
await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
|
||||
await testImage(server.url, 'video_short1.webm', video.thumbnailPath)
|
||||
|
||||
const live = await server.liveCommand.getLive({ videoId: liveVideoUUID })
|
||||
const live = await server.liveCommand.get({ videoId: liveVideoUUID })
|
||||
|
||||
if (server.url === servers[0].url) {
|
||||
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
|
||||
|
@ -151,7 +151,7 @@ describe('Test live', function () {
|
|||
nsfw: true
|
||||
}
|
||||
|
||||
const live = await commands[0].createLive({ fields: attributes })
|
||||
const live = await commands[0].create({ fields: attributes })
|
||||
const videoId = live.uuid
|
||||
|
||||
await waitJobs(servers)
|
||||
|
@ -178,19 +178,19 @@ describe('Test live', function () {
|
|||
})
|
||||
|
||||
it('Should not be able to update a live of another server', async function () {
|
||||
await commands[1].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
await commands[1].update({ videoId: liveVideoUUID, fields: { saveReplay: false }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
})
|
||||
|
||||
it('Should update the live', async function () {
|
||||
this.timeout(10000)
|
||||
|
||||
await commands[0].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false } })
|
||||
await commands[0].update({ videoId: liveVideoUUID, fields: { saveReplay: false } })
|
||||
await waitJobs(servers)
|
||||
})
|
||||
|
||||
it('Have the live updated', async function () {
|
||||
for (const server of servers) {
|
||||
const live = await server.liveCommand.getLive({ videoId: liveVideoUUID })
|
||||
const live = await server.liveCommand.get({ videoId: liveVideoUUID })
|
||||
|
||||
if (server.url === servers[0].url) {
|
||||
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
|
||||
|
@ -214,7 +214,7 @@ describe('Test live', function () {
|
|||
it('Should have the live deleted', async function () {
|
||||
for (const server of servers) {
|
||||
await getVideo(server.url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
|
||||
await server.liveCommand.getLive({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
await server.liveCommand.get({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -230,7 +230,7 @@ describe('Test live', function () {
|
|||
vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid
|
||||
|
||||
const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id }
|
||||
const live = await commands[0].createLive({ fields: liveOptions })
|
||||
const live = await commands[0].create({ fields: liveOptions })
|
||||
liveVideoId = live.uuid
|
||||
|
||||
ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId })
|
||||
|
@ -297,9 +297,9 @@ describe('Test live', function () {
|
|||
saveReplay: false
|
||||
}
|
||||
|
||||
const { uuid } = await commands[0].createLive({ fields: liveAttributes })
|
||||
const { uuid } = await commands[0].create({ fields: liveAttributes })
|
||||
|
||||
const live = await commands[0].getLive({ videoId: uuid })
|
||||
const live = await commands[0].get({ videoId: uuid })
|
||||
const resVideo = await getVideo(servers[0].url, uuid)
|
||||
|
||||
return Object.assign(resVideo.body as VideoDetails, live)
|
||||
|
@ -376,7 +376,7 @@ describe('Test live', function () {
|
|||
saveReplay
|
||||
}
|
||||
|
||||
const { uuid } = await commands[0].createLive({ fields: liveAttributes })
|
||||
const { uuid } = await commands[0].create({ fields: liveAttributes })
|
||||
return uuid
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ describe('Test live', function () {
|
|||
for (let i = 0; i < resolutions.length; i++) {
|
||||
const segmentNum = 3
|
||||
const segmentName = `${i}-00000${segmentNum}.ts`
|
||||
await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum })
|
||||
await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum })
|
||||
|
||||
const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`)
|
||||
const subPlaylist = res.text
|
||||
|
@ -488,7 +488,7 @@ describe('Test live', function () {
|
|||
await testVideoResolutions(liveVideoId, resolutions)
|
||||
|
||||
await stopFfmpeg(ffmpegCommand)
|
||||
await commands[0].waitUntilLiveEnded({ videoId: liveVideoId })
|
||||
await commands[0].waitUntilEnded({ videoId: liveVideoId })
|
||||
|
||||
await waitJobs(servers)
|
||||
|
||||
|
@ -559,7 +559,7 @@ describe('Test live', function () {
|
|||
saveReplay
|
||||
}
|
||||
|
||||
const { uuid } = await commands[0].createLive({ fields: liveAttributes })
|
||||
const { uuid } = await commands[0].create({ fields: liveAttributes })
|
||||
return uuid
|
||||
}
|
||||
|
||||
|
@ -575,14 +575,14 @@ describe('Test live', function () {
|
|||
])
|
||||
|
||||
await Promise.all([
|
||||
commands[0].waitUntilLivePublished({ videoId: liveVideoId }),
|
||||
commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId })
|
||||
commands[0].waitUntilPublished({ videoId: liveVideoId }),
|
||||
commands[0].waitUntilPublished({ videoId: liveVideoReplayId })
|
||||
])
|
||||
|
||||
await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 })
|
||||
await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 })
|
||||
await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 })
|
||||
await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 })
|
||||
|
||||
await killallServers([ servers[0] ])
|
||||
killallServers([ servers[0] ])
|
||||
await reRunServer(servers[0])
|
||||
|
||||
await wait(5000)
|
||||
|
@ -591,13 +591,13 @@ describe('Test live', function () {
|
|||
it('Should cleanup lives', async function () {
|
||||
this.timeout(60000)
|
||||
|
||||
await commands[0].waitUntilLiveEnded({ videoId: liveVideoId })
|
||||
await commands[0].waitUntilEnded({ videoId: liveVideoId })
|
||||
})
|
||||
|
||||
it('Should save a live replay', async function () {
|
||||
this.timeout(120000)
|
||||
|
||||
await commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId })
|
||||
await commands[0].waitUntilPublished({ videoId: liveVideoReplayId })
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -502,10 +502,10 @@ describe('Test videos search', function () {
|
|||
const liveCommand = server.liveCommand
|
||||
|
||||
const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id }
|
||||
const live = await liveCommand.createLive({ fields: liveAttributes })
|
||||
const live = await liveCommand.create({ fields: liveAttributes })
|
||||
|
||||
const ffmpegCommand = await liveCommand.sendRTMPStreamInVideo({ videoId: live.id })
|
||||
await liveCommand.waitUntilLivePublished({ videoId: live.id })
|
||||
await liveCommand.waitUntilPublished({ videoId: live.id })
|
||||
|
||||
const body = await command.advancedVideoSearch({ search: { isLive: true } })
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ describe('Test video change ownership - nominal', function () {
|
|||
|
||||
{
|
||||
const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC }
|
||||
const video = await servers[0].liveCommand.createLive({ token: firstUserAccessToken, fields: attributes })
|
||||
const video = await servers[0].liveCommand.create({ token: firstUserAccessToken, fields: attributes })
|
||||
|
||||
liveId = video.id
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ describe('Test plugin action hooks', function () {
|
|||
channelId: servers[0].videoChannel.id
|
||||
}
|
||||
|
||||
await servers[0].liveCommand.createLive({ fields: attributes })
|
||||
await servers[0].liveCommand.create({ fields: attributes })
|
||||
|
||||
await checkHook('action:api.live-video.created')
|
||||
})
|
||||
|
|
|
@ -155,7 +155,7 @@ describe('Test plugin filter hooks', function () {
|
|||
channelId: servers[0].videoChannel.id
|
||||
}
|
||||
|
||||
await servers[0].liveCommand.createLive({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
await servers[0].liveCommand.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
||||
})
|
||||
|
||||
it('Should run filter:api.video.pre-import-url.accept.result', async function () {
|
||||
|
|
|
@ -26,7 +26,7 @@ async function createLiveWrapper (server: ServerInfo) {
|
|||
privacy: VideoPrivacy.PUBLIC
|
||||
}
|
||||
|
||||
const { uuid } = await server.liveCommand.createLive({ fields: liveAttributes })
|
||||
const { uuid } = await server.liveCommand.create({ fields: liveAttributes })
|
||||
|
||||
return uuid
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ describe('Test transcoding plugins', function () {
|
|||
const liveVideoId = await createLiveWrapper(server)
|
||||
|
||||
await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
|
||||
await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
|
||||
await waitJobs([ server ])
|
||||
|
||||
await checkLiveFPS(liveVideoId, 'above', 20)
|
||||
|
@ -184,7 +184,7 @@ describe('Test transcoding plugins', function () {
|
|||
const liveVideoId = await createLiveWrapper(server)
|
||||
|
||||
await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
|
||||
await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
|
||||
await waitJobs([ server ])
|
||||
|
||||
await checkLiveFPS(liveVideoId, 'below', 12)
|
||||
|
@ -198,7 +198,7 @@ describe('Test transcoding plugins', function () {
|
|||
const liveVideoId = await createLiveWrapper(server)
|
||||
|
||||
await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
|
||||
await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
|
||||
await waitJobs([ server ])
|
||||
|
||||
await checkLiveFPS(liveVideoId, 'below', 6)
|
||||
|
@ -261,7 +261,7 @@ describe('Test transcoding plugins', function () {
|
|||
const liveVideoId = await createLiveWrapper(server)
|
||||
|
||||
await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
|
||||
await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
|
||||
await waitJobs([ server ])
|
||||
|
||||
const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8`
|
||||
|
|
|
@ -14,7 +14,7 @@ import { getVideoWithToken } from './videos'
|
|||
|
||||
export class LiveCommand extends AbstractCommand {
|
||||
|
||||
getLive (options: OverrideCommandOptions & {
|
||||
get (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
}) {
|
||||
const path = '/api/v1/videos/live'
|
||||
|
@ -27,7 +27,7 @@ export class LiveCommand extends AbstractCommand {
|
|||
})
|
||||
}
|
||||
|
||||
updateLive (options: OverrideCommandOptions & {
|
||||
update (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
fields: LiveVideoUpdate
|
||||
}) {
|
||||
|
@ -43,7 +43,7 @@ export class LiveCommand extends AbstractCommand {
|
|||
})
|
||||
}
|
||||
|
||||
async createLive (options: OverrideCommandOptions & {
|
||||
async create (options: OverrideCommandOptions & {
|
||||
fields: LiveVideoCreate
|
||||
}) {
|
||||
const { fields } = options
|
||||
|
@ -70,12 +70,12 @@ export class LiveCommand extends AbstractCommand {
|
|||
fixtureName?: string
|
||||
}) {
|
||||
const { videoId, fixtureName } = options
|
||||
const videoLive = await this.getLive({ videoId })
|
||||
const videoLive = await this.get({ videoId })
|
||||
|
||||
return sendRTMPStream(videoLive.rtmpUrl, videoLive.streamKey, fixtureName)
|
||||
}
|
||||
|
||||
async runAndTestFfmpegStreamError (options: OverrideCommandOptions & {
|
||||
async runAndTestStreamError (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
shouldHaveError: boolean
|
||||
}) {
|
||||
|
@ -84,28 +84,28 @@ export class LiveCommand extends AbstractCommand {
|
|||
return testFfmpegStreamError(command, options.shouldHaveError)
|
||||
}
|
||||
|
||||
waitUntilLivePublished (options: OverrideCommandOptions & {
|
||||
waitUntilPublished (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
}) {
|
||||
const { videoId } = options
|
||||
return this.waitUntilLiveState({ videoId, state: VideoState.PUBLISHED })
|
||||
return this.waitUntilState({ videoId, state: VideoState.PUBLISHED })
|
||||
}
|
||||
|
||||
waitUntilLiveWaiting (options: OverrideCommandOptions & {
|
||||
waitUntilWaiting (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
}) {
|
||||
const { videoId } = options
|
||||
return this.waitUntilLiveState({ videoId, state: VideoState.WAITING_FOR_LIVE })
|
||||
return this.waitUntilState({ videoId, state: VideoState.WAITING_FOR_LIVE })
|
||||
}
|
||||
|
||||
waitUntilLiveEnded (options: OverrideCommandOptions & {
|
||||
waitUntilEnded (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
}) {
|
||||
const { videoId } = options
|
||||
return this.waitUntilLiveState({ videoId, state: VideoState.LIVE_ENDED })
|
||||
return this.waitUntilState({ videoId, state: VideoState.LIVE_ENDED })
|
||||
}
|
||||
|
||||
waitUntilLiveSegmentGeneration (options: OverrideCommandOptions & {
|
||||
waitUntilSegmentGeneration (options: OverrideCommandOptions & {
|
||||
videoUUID: string
|
||||
resolution: number
|
||||
segment: number
|
||||
|
@ -116,7 +116,7 @@ export class LiveCommand extends AbstractCommand {
|
|||
return waitUntilLog(this.server, `${videoUUID}/${segmentName}`, 2, false)
|
||||
}
|
||||
|
||||
async waitUntilLiveSaved (options: OverrideCommandOptions & {
|
||||
async waitUntilSaved (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
}) {
|
||||
let video: VideoDetails
|
||||
|
@ -129,7 +129,7 @@ export class LiveCommand extends AbstractCommand {
|
|||
} while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
|
||||
}
|
||||
|
||||
async getPlaylistsCount (options: OverrideCommandOptions & {
|
||||
async countPlaylists (options: OverrideCommandOptions & {
|
||||
videoUUID: string
|
||||
}) {
|
||||
const basePath = buildServerDirectory(this.server, 'streaming-playlists')
|
||||
|
@ -140,7 +140,7 @@ export class LiveCommand extends AbstractCommand {
|
|||
return files.filter(f => f.endsWith('.m3u8')).length
|
||||
}
|
||||
|
||||
private async waitUntilLiveState (options: OverrideCommandOptions & {
|
||||
private async waitUntilState (options: OverrideCommandOptions & {
|
||||
videoId: number | string
|
||||
state: VideoState
|
||||
}) {
|
||||
|
|
|
@ -72,7 +72,7 @@ async function stopFfmpeg (command: ffmpeg.FfmpegCommand) {
|
|||
|
||||
async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) {
|
||||
for (const server of servers) {
|
||||
await server.liveCommand.waitUntilLivePublished({ videoId })
|
||||
await server.liveCommand.waitUntilPublished({ videoId })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue