command.outputOption('-c:v libx264')
command.outputOption('-g 50')
command.outputOption('-keyint_min 2')
+ command.outputOption('-r 60')
command.outputOption('-f flv')
const rtmpUrl = rtmpBaseUrl + '/' + streamKey
await wait(500)
}
-async function waitUntilLiveStarts (url: string, token: string, videoId: number | string) {
+function waitUntilLiveStarts (url: string, token: string, videoId: number | string) {
+ return waitWhileLiveState(url, token, videoId, VideoState.WAITING_FOR_LIVE)
+}
+
+function waitUntilLivePublished (url: string, token: string, videoId: number | string) {
+ return waitWhileLiveState(url, token, videoId, VideoState.PUBLISHED)
+}
+
+function waitUntilLiveEnded (url: string, token: string, videoId: number | string) {
+ return waitWhileLiveState(url, token, videoId, VideoState.LIVE_ENDED)
+}
+
+async function waitWhileLiveState (url: string, token: string, videoId: number | string, state: VideoState) {
let video: VideoDetails
do {
video = res.body
await wait(500)
- } while (video.state.id === VideoState.WAITING_FOR_LIVE)
+ } while (video.state.id === state)
}
async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
export {
getLive,
+ waitUntilLivePublished,
updateLive,
waitUntilLiveStarts,
createLive,
checkLiveCleanup,
stopFfmpeg,
sendRTMPStreamInVideo,
+ waitUntilLiveEnded,
waitFfmpegUntilError,
sendRTMPStream,
testFfmpegStreamError