Skip to content

Commit 8914db3

Browse files
committed
Add NO_AUDIO status to video transcription flow
1 parent f39a4ec commit 8914db3

7 files changed

Lines changed: 66 additions & 6 deletions

File tree

apps/web/actions/videos/get-status.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ import { generateAiMetadata } from "./generate-ai-metadata";
1515

1616
const MAX_AI_PROCESSING_TIME = 10 * 60 * 1000;
1717

18-
type TranscriptionStatus = "PROCESSING" | "COMPLETE" | "ERROR" | "SKIPPED";
18+
type TranscriptionStatus =
19+
| "PROCESSING"
20+
| "COMPLETE"
21+
| "ERROR"
22+
| "SKIPPED"
23+
| "NO_AUDIO";
1924

2025
export interface VideoStatusResult {
2126
transcriptionStatus: TranscriptionStatus | null;

apps/web/app/embed/[videoId]/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ async function EmbedContent({
250250

251251
if (
252252
video.transcriptionStatus !== "COMPLETE" &&
253-
video.transcriptionStatus !== "PROCESSING"
253+
video.transcriptionStatus !== "PROCESSING" &&
254+
video.transcriptionStatus !== "SKIPPED" &&
255+
video.transcriptionStatus !== "NO_AUDIO"
254256
) {
255257
transcribeVideo(video.id, video.ownerId, aiGenerationEnabled);
256258
}

apps/web/app/s/[videoId]/Share.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ const useVideoStatus = (
178178
| "PROCESSING"
179179
| "COMPLETE"
180180
| "ERROR"
181+
| "SKIPPED"
182+
| "NO_AUDIO"
181183
| null,
182184
aiProcessing: initialData.aiData?.processing || false,
183185
aiGenerationSkipped: initialData.aiData?.generationSkipped || false,
@@ -198,7 +200,11 @@ const useVideoStatus = (
198200
return true;
199201
}
200202

201-
if (data.transcriptionStatus === "ERROR") {
203+
if (
204+
data.transcriptionStatus === "ERROR" ||
205+
data.transcriptionStatus === "SKIPPED" ||
206+
data.transcriptionStatus === "NO_AUDIO"
207+
) {
202208
return false;
203209
}
204210

@@ -298,7 +304,11 @@ export const Share = ({
298304
return true;
299305
}
300306

301-
if (transcriptionStatus === "ERROR") {
307+
if (
308+
transcriptionStatus === "ERROR" ||
309+
transcriptionStatus === "SKIPPED" ||
310+
transcriptionStatus === "NO_AUDIO"
311+
) {
302312
return false;
303313
}
304314

apps/web/app/s/[videoId]/_components/tabs/Transcript.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ export const Transcript: React.FC<TranscriptProps> = ({ data, onSeek }) => {
173173
}, [transcriptContent]);
174174

175175
const isTranscriptionProcessing = useMemo(() => {
176+
if (
177+
data.transcriptionStatus === "SKIPPED" ||
178+
data.transcriptionStatus === "NO_AUDIO"
179+
) {
180+
return false;
181+
}
176182
if (retryTriggered && data.transcriptionStatus !== "COMPLETE") {
177183
return true;
178184
}
@@ -400,6 +406,38 @@ export const Transcript: React.FC<TranscriptProps> = ({ data, onSeek }) => {
400406
);
401407
}
402408

409+
if (data.transcriptionStatus === "NO_AUDIO") {
410+
return (
411+
<div className="flex justify-center items-center h-full text-gray-1">
412+
<div className="text-center">
413+
<MessageSquare className="mx-auto mb-2 w-8 h-8 text-gray-300" />
414+
<p className="text-sm font-medium text-gray-12">
415+
No audio track detected
416+
</p>
417+
<p className="mt-1 text-xs text-gray-9">
418+
This video doesn't contain audio for transcription
419+
</p>
420+
</div>
421+
</div>
422+
);
423+
}
424+
425+
if (data.transcriptionStatus === "SKIPPED") {
426+
return (
427+
<div className="flex justify-center items-center h-full text-gray-1">
428+
<div className="text-center">
429+
<MessageSquare className="mx-auto mb-2 w-8 h-8 text-gray-300" />
430+
<p className="text-sm font-medium text-gray-12">
431+
Transcription disabled
432+
</p>
433+
<p className="mt-1 text-xs text-gray-9">
434+
Transcription has been disabled for this video
435+
</p>
436+
</div>
437+
</div>
438+
);
439+
}
440+
403441
const showRetryButton =
404442
data.transcriptionStatus === "ERROR" ||
405443
hasTimedOut ||

apps/web/app/s/[videoId]/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ async function AuthorizedContent({
451451

452452
if (
453453
video.transcriptionStatus !== "COMPLETE" &&
454-
video.transcriptionStatus !== "PROCESSING"
454+
video.transcriptionStatus !== "PROCESSING" &&
455+
video.transcriptionStatus !== "SKIPPED" &&
456+
video.transcriptionStatus !== "NO_AUDIO"
455457
) {
456458
console.log("[ShareVideoPage] Starting transcription for video:", videoId);
457459
transcribeVideo(videoId, video.owner.id, aiGenerationEnabled).catch(

apps/web/lib/transcribe.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ export async function transcribeVideo(
8585

8686
if (
8787
video.transcriptionStatus === "COMPLETE" ||
88-
video.transcriptionStatus === "PROCESSING"
88+
video.transcriptionStatus === "PROCESSING" ||
89+
video.transcriptionStatus === "SKIPPED" ||
90+
video.transcriptionStatus === "NO_AUDIO"
8991
) {
9092
return {
9193
success: true,

packages/web-api-contract-effect/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const TranscriptionStatus = Schema.Literal(
1313
"COMPLETE",
1414
"ERROR",
1515
"SKIPPED",
16+
"NO_AUDIO",
1617
);
1718
const OSType = Schema.Literal("macos", "windows");
1819
const LicenseType = Schema.Literal("yearly", "lifetime");

0 commit comments

Comments
 (0)