import { program } from 'commander'
import { LiveVideoCreate, VideoPrivacy } from '@shared/models'
import {
- flushAndRunServer,
+ createSingleServer,
killallServers,
sendRTMPStream,
- ServerInfo,
+ PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '../../shared/extra-utils'
console.log('Starting server.')
- const server = await flushAndRunServer(1, {}, [], { hideLogs: false, execArgv: [ '--inspect' ] })
+ const server = await createSingleServer(1, {}, { hideLogs: false, nodeArgs: [ '--inspect' ] })
const cleanup = async () => {
console.log('Killing server')
const attributes: LiveVideoCreate = {
name: 'live',
saveReplay: true,
- channelId: server.videoChannel.id,
+ channelId: server.store.channel.id,
privacy: VideoPrivacy.PUBLIC
}
console.log('Creating live.')
- const { uuid: liveVideoUUID } = await server.liveCommand.create({ fields: attributes })
+ const { uuid: liveVideoUUID } = await server.live.create({ fields: attributes })
- const live = await server.liveCommand.get({ videoId: liveVideoUUID })
+ const live = await server.live.get({ videoId: liveVideoUUID })
console.log('Sending RTMP stream.')
- const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey)
+ const ffmpegCommand = sendRTMPStream({ rtmpBaseUrl: live.rtmpUrl, streamKey: live.streamKey })
ffmpegCommand.on('error', err => {
console.error(err)
// ----------------------------------------------------------------------------
-async function buildConfig (server: ServerInfo, commandType: CommandType) {
- await server.configCommand.updateCustomSubConfig({
+async function buildConfig (server: PeerTubeServer, commandType: CommandType) {
+ await server.config.updateCustomSubConfig({
newConfig: {
instance: {
customizations: {