doubleFollow,
flushAndRunMultipleServers,
getLive,
+ getMyVideosWithFilter,
getPlaylist,
getVideo,
getVideoIdFromUUID,
getVideosList,
+ getVideosWithFilters,
killallServers,
makeRawRequest,
removeVideo,
testImage,
updateCustomSubConfig,
updateLive,
+ uploadVideoAndGetId,
viewVideo,
wait,
waitJobs,
describe('Test live', function () {
let servers: ServerInfo[] = []
+ async function waitUntilLivePublishedOnAllServers (videoId: string) {
+ for (const server of servers) {
+ await waitUntilLivePublished(server.url, server.accessToken, videoId)
+ }
+ }
+
before(async function () {
this.timeout(120000)
expect(video.channel.name).to.equal(servers[0].videoChannel.name)
expect(video.channel.host).to.equal(servers[0].videoChannel.host)
+ expect(video.isLive).to.be.true
+
expect(video.nsfw).to.be.false
expect(video.waitTranscoding).to.be.false
expect(video.name).to.equal('my super live')
})
})
+ describe('Live filters', function () {
+ let command: any
+ let liveVideoId: string
+ let vodVideoId: string
+
+ before(async function () {
+ this.timeout(120000)
+
+ vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid
+
+ const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id }
+ const resLive = await createLive(servers[0].url, servers[0].accessToken, liveOptions)
+ liveVideoId = resLive.body.video.uuid
+
+ command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId)
+ await waitUntilLivePublishedOnAllServers(liveVideoId)
+ await waitJobs(servers)
+ })
+
+ it('Should only display lives', async function () {
+ const res = await getVideosWithFilters(servers[0].url, { isLive: true })
+
+ expect(res.body.total).to.equal(1)
+ expect(res.body.data).to.have.lengthOf(1)
+ expect(res.body.data[0].name).to.equal('live')
+ })
+
+ it('Should not display lives', async function () {
+ const res = await getVideosWithFilters(servers[0].url, { isLive: false })
+
+ expect(res.body.total).to.equal(1)
+ expect(res.body.data).to.have.lengthOf(1)
+ expect(res.body.data[0].name).to.equal('vod video')
+ })
+
+ it('Should display my lives', async function () {
+ this.timeout(60000)
+
+ await stopFfmpeg(command)
+ await waitJobs(servers)
+
+ const res = await getMyVideosWithFilter(servers[0].url, servers[0].accessToken, { isLive: true })
+ const videos = res.body.data as Video[]
+
+ const result = videos.every(v => v.isLive)
+ expect(result).to.be.true
+ })
+
+ it('Should not display my lives', async function () {
+ const res = await getMyVideosWithFilter(servers[0].url, servers[0].accessToken, { isLive: false })
+ const videos = res.body.data as Video[]
+
+ const result = videos.every(v => !v.isLive)
+ expect(result).to.be.true
+ })
+
+ after(async function () {
+ await removeVideo(servers[0].url, servers[0].accessToken, vodVideoId)
+ await removeVideo(servers[0].url, servers[0].accessToken, liveVideoId)
+ })
+ })
+
describe('Stream checks', function () {
let liveVideo: LiveVideo & VideoDetails
let rtmpUrl: string
}
it('Should not allow a stream without the appropriate path', async function () {
- this.timeout(30000)
+ this.timeout(60000)
liveVideo = await createLiveWrapper()
})
it('Should not allow a stream without the appropriate stream key', async function () {
- this.timeout(30000)
+ this.timeout(60000)
const command = sendRTMPStream(rtmpUrl + '/live', 'bad-stream-key')
await testFfmpegStreamError(command, true)
})
it('Should succeed with the correct params', async function () {
- this.timeout(30000)
+ this.timeout(60000)
const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey)
await testFfmpegStreamError(command, false)
})
+ it('Should list this live now someone stream into it', async function () {
+ for (const server of servers) {
+ const res = await getVideosList(server.url)
+
+ expect(res.body.total).to.equal(1)
+ expect(res.body.data).to.have.lengthOf(1)
+
+ const video: Video = res.body.data[0]
+
+ expect(video.name).to.equal('user live')
+ expect(video.isLive).to.be.true
+ }
+ })
+
it('Should not allow a stream on a live that was blacklisted', async function () {
- this.timeout(30000)
+ this.timeout(60000)
liveVideo = await createLiveWrapper()
})
it('Should not allow a stream on a live that was deleted', async function () {
- this.timeout(30000)
+ this.timeout(60000)
liveVideo = await createLiveWrapper()
live: {
enabled: true,
allowReplay: true,
- maxDuration: null,
+ maxDuration: -1,
transcoding: {
enabled: true,
resolutions: {
})
it('Should enable transcoding without additional resolutions', async function () {
- this.timeout(30000)
+ this.timeout(60000)
liveVideoId = await createLiveWrapper(false)
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId)
- await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId)
+ await waitUntilLivePublishedOnAllServers(liveVideoId)
await waitJobs(servers)
await testVideoResolutions(liveVideoId, [ 720 ])
})
it('Should enable transcoding with some resolutions', async function () {
- this.timeout(30000)
+ this.timeout(60000)
const resolutions = [ 240, 480 ]
await updateConf(resolutions)
liveVideoId = await createLiveWrapper(false)
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId)
- await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId)
+ await waitUntilLivePublishedOnAllServers(liveVideoId)
await waitJobs(servers)
await testVideoResolutions(liveVideoId, resolutions)
})
it('Should enable transcoding with some resolutions and correctly save them', async function () {
- this.timeout(120000)
+ this.timeout(200000)
const resolutions = [ 240, 360, 720 ]
liveVideoId = await createLiveWrapper(true)
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm')
- await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId)
+ await waitUntilLivePublishedOnAllServers(liveVideoId)
await waitJobs(servers)
await testVideoResolutions(liveVideoId, resolutions)
await stopFfmpeg(command)
+ await waitUntilLiveEnded(servers[0].url, servers[0].accessToken, liveVideoId)
+
await waitJobs(servers)
- await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId)
+ await waitUntilLivePublishedOnAllServers(liveVideoId)
const bitrateLimits = {
720: 5000 * 1000, // 60FPS
liveVideoId = res.body.video.uuid
command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId)
- await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId)
+ await waitUntilLivePublishedOnAllServers(liveVideoId)
await waitJobs(servers)
})
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
- for (const server of servers) {
- await waitUntilLivePublished(server.url, server.accessToken, liveVideoUUID)
- }
-
+ await waitUntilLivePublishedOnAllServers(liveVideoUUID)
await waitJobs(servers)
for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
for (const server of servers) {
await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID)
}
-
await waitJobs(servers)
for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
- for (const server of servers) {
- await waitUntilLivePublished(server.url, server.accessToken, liveVideoUUID)
- }
-
+ await waitUntilLivePublishedOnAllServers(liveVideoUUID)
await waitJobs(servers)
expect(localLastVideoViews).to.equal(0)
socket.emit('subscribe', { videoId })
const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
- await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID)
+
+ await waitUntilLivePublishedOnAllServers(liveVideoUUID)
await waitJobs(servers)
expect(stateChanges).to.have.lengthOf(1)