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)
+}
+
+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,