]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/live-command.ts
chore(refactor): remove shared folder dependencies to the server
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / live-command.ts
index 9dfe3087ee208e3b241475dcb0f9591b180ba473..74f5d30899ceadc53a2c1d8ee6a2338fb5ddeeda 100644 (file)
@@ -3,8 +3,7 @@
 import { readdir } from 'fs-extra'
 import { omit } from 'lodash'
 import { join } from 'path'
-import { HttpStatusCode } from '@shared/models'
-import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
+import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
 import { wait } from '../miscs'
 import { unwrapBody } from '../requests'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
@@ -69,11 +68,12 @@ export class LiveCommand extends AbstractCommand {
   async sendRTMPStreamInVideo (options: OverrideCommandOptions & {
     videoId: number | string
     fixtureName?: string
+    copyCodecs?: boolean
   }) {
-    const { videoId, fixtureName } = options
+    const { videoId, fixtureName, copyCodecs } = options
     const videoLive = await this.get({ videoId })
 
-    return sendRTMPStream(videoLive.rtmpUrl, videoLive.streamKey, fixtureName)
+    return sendRTMPStream({ rtmpBaseUrl: videoLive.rtmpUrl, streamKey: videoLive.streamKey, fixtureName, copyCodecs })
   }
 
   async runAndTestStreamError (options: OverrideCommandOptions & {
@@ -126,7 +126,7 @@ export class LiveCommand extends AbstractCommand {
       video = await this.server.videos.getWithToken({ token: options.token, id: options.videoId })
 
       await wait(500)
-    } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
+    } while (video.isLive === true || video.state.id !== VideoState.PUBLISHED)
   }
 
   async countPlaylists (options: OverrideCommandOptions & {