@musallam/audio-video-client
    Preparing search index...

    Function pollAudioVideoJob

    • Polls an Audio and Video API async job until completion

      This function works with all job types in the Audio and Video API:

      • Template jobs (describe, render)
      • Speech generation jobs
      • Transcription jobs
      • Dubbing jobs
      • Avatar generation jobs
      • Video reframing jobs (v1 and v2)

      Parameters

      Returns Promise<AudioVideoJobStatusResponse>

      The final job status when succeeded

      If max attempts or timeout is reached

      If the job fails

      // Template rendering
      const renderJob = await AudioVideoClient.templateRender({ source, variations });
      const result = await pollAudioVideoJob(renderJob, {
      axiosRequestConfig: { headers },
      onProgress: (status) => console.log(`Status: ${status.status}`)
      });

      // Speech generation
      const speechJob = await AudioVideoClient.generateSpeech({ text: 'Hello world' });
      const speechResult = await pollAudioVideoJob(speechJob, { axiosRequestConfig: { headers } });

      // Video reframing
      const reframeJob = await AudioVideoClient.generateReframedVideoV2({ input, outputs });
      const reframeResult = await pollAudioVideoJob(reframeJob, { axiosRequestConfig: { headers } });