import { expect } from 'chai'
import { basename, join } from 'path'
-import { ffprobePromise, getVideoStream } from '@server/helpers/ffmpeg'
-import { testImage, testVideoResolutions } from '@server/tests/shared'
+import { SQLCommand, testImage, testLiveVideoResolutions } from '@server/tests/shared'
import { getAllFiles, wait } from '@shared/core-utils'
+import { ffprobePromise, getVideoStream } from '@shared/ffmpeg'
import {
HttpStatusCode,
LiveVideo,
doubleFollow,
killallServers,
LiveCommand,
+ makeGetRequest,
makeRawRequest,
PeerTubeServer,
sendRTMPStream,
commentsEnabled: false,
downloadEnabled: false,
saveReplay: true,
+ replaySettings: { privacy: VideoPrivacy.PUBLIC },
latencyMode: LiveVideoLatencyMode.SMALL_LATENCY,
privacy: VideoPrivacy.PUBLIC,
previewfile: 'video_short1-preview.webm.jpg',
if (server.url === servers[0].url) {
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
expect(live.streamKey).to.not.be.empty
+
+ expect(live.replaySettings).to.exist
+ expect(live.replaySettings.privacy).to.equal(VideoPrivacy.PUBLIC)
} else {
expect(live.rtmpUrl).to.not.exist
expect(live.streamKey).to.not.exist
expect(video.privacy.id).to.equal(VideoPrivacy.UNLISTED)
expect(video.nsfw).to.be.true
- await makeRawRequest(server.url + video.thumbnailPath, HttpStatusCode.OK_200)
- await makeRawRequest(server.url + video.previewPath, HttpStatusCode.OK_200)
+ await makeGetRequest({ url: server.url, path: video.thumbnailPath, expectedStatus: HttpStatusCode.OK_200 })
+ await makeGetRequest({ url: server.url, path: video.previewPath, expectedStatus: HttpStatusCode.OK_200 })
}
})
}
expect(live.saveReplay).to.be.false
+ expect(live.replaySettings).to.not.exist
expect(live.latencyMode).to.equal(LiveVideoLatencyMode.DEFAULT)
}
})
describe('Live transcoding', function () {
let liveVideoId: string
+ let sqlCommandServer1: SQLCommand
async function createLiveWrapper (saveReplay: boolean) {
const liveAttributes = {
name: 'live video',
channelId: servers[0].store.channel.id,
privacy: VideoPrivacy.PUBLIC,
- saveReplay
+ saveReplay,
+ replaySettings: saveReplay
+ ? { privacy: VideoPrivacy.PUBLIC }
+ : undefined
}
const { uuid } = await commands[0].create({ fields: liveAttributes })
before(async function () {
await updateConf([])
+
+ sqlCommandServer1 = new SQLCommand(servers[0])
})
it('Should enable transcoding without additional resolutions', async function () {
await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
await waitJobs(servers)
- await testVideoResolutions({
+ await testLiveVideoResolutions({
originServer: servers[0],
+ sqlCommand: sqlCommandServer1,
servers,
liveVideoId,
resolutions: [ 720 ],
await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
await waitJobs(servers)
- await testVideoResolutions({
+ await testLiveVideoResolutions({
originServer: servers[0],
+ sqlCommand: sqlCommandServer1,
servers,
liveVideoId,
resolutions: resolutions.concat([ 720 ]),
await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
await waitJobs(servers)
- await testVideoResolutions({
+ await testLiveVideoResolutions({
originServer: servers[0],
+ sqlCommand: sqlCommandServer1,
servers,
liveVideoId,
resolutions,
expect(video.files).to.have.lengthOf(0)
const hlsPlaylist = video.streamingPlaylists.find(s => s.type === VideoStreamingPlaylistType.HLS)
- await makeRawRequest(hlsPlaylist.playlistUrl, HttpStatusCode.OK_200)
- await makeRawRequest(hlsPlaylist.segmentsSha256Url, HttpStatusCode.OK_200)
+ await makeRawRequest({ url: hlsPlaylist.playlistUrl, expectedStatus: HttpStatusCode.OK_200 })
+ await makeRawRequest({ url: hlsPlaylist.segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 })
// We should have generated random filenames
expect(basename(hlsPlaylist.playlistUrl)).to.not.equal('master.m3u8')
expect(probe.format.bit_rate).to.be.below(maxBitrateLimits[videoStream.height])
expect(probe.format.bit_rate).to.be.at.least(minBitrateLimits[videoStream.height])
- await makeRawRequest(file.torrentUrl, HttpStatusCode.OK_200)
- await makeRawRequest(file.fileUrl, HttpStatusCode.OK_200)
+ await makeRawRequest({ url: file.torrentUrl, expectedStatus: HttpStatusCode.OK_200 })
+ await makeRawRequest({ url: file.fileUrl, expectedStatus: HttpStatusCode.OK_200 })
}
}
})
await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
await waitJobs(servers)
- await testVideoResolutions({
+ await testLiveVideoResolutions({
originServer: servers[0],
+ sqlCommand: sqlCommandServer1,
servers,
liveVideoId,
resolutions,
await waitUntilLivePublishedOnAllServers(servers, liveVideoId)
await waitJobs(servers)
- await testVideoResolutions({
+ await testLiveVideoResolutions({
originServer: servers[0],
+ sqlCommand: sqlCommandServer1,
servers,
liveVideoId,
resolutions: [ 720 ],
expect(hlsFiles[0].resolution.id).to.equal(720)
})
+
+ after(async function () {
+ await sqlCommandServer1.cleanup()
+ })
})
describe('After a server restart', function () {
channelId: servers[0].store.channel.id,
privacy: VideoPrivacy.PUBLIC,
saveReplay: options.saveReplay,
+ replaySettings: options.saveReplay
+ ? { privacy: VideoPrivacy.PUBLIC }
+ : undefined,
permanentLive: options.permanent
}