* Picks the best transcript file from a recording's files array. * Prefers the AI Companion audio_transcript (file_type TRANSCRIPT) and falls back * to closed captions (file_type CC) — both are VTT and contain spoken text.
(files?: ZoomRecordingFile[])
| 116 | * to closed captions (file_type CC) — both are VTT and contain spoken text. |
| 117 | */ |
| 118 | function findTranscriptFile(files?: ZoomRecordingFile[]): ZoomRecordingFile | undefined { |
| 119 | if (!files) return undefined |
| 120 | const eligible = (f: ZoomRecordingFile) => |
| 121 | Boolean(f.download_url) && (f.status === 'completed' || f.status == null) |
| 122 | |
| 123 | const transcript = files.find((f) => f.file_type === 'TRANSCRIPT' && eligible(f)) |
| 124 | if (transcript) return transcript |
| 125 | return files.find((f) => f.file_type === 'CC' && eligible(f)) |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Extracts spoken text from a Zoom WebVTT transcript, stripping cue identifiers, |