mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-26 15:55:35 +00:00
fix: address CodeRabbit review — muxing error guard, dead code removal, i18n
- Add encoderError check after awaiting pendingMuxing to prevent finalization of corrupt exports (both exporters) - Remove unreachable synchronous fast-path in getMediaDurationSec - Set preload='metadata' before src for correct browser behavior - Localize audio processing status text with t()
This commit is contained in:
@@ -4454,7 +4454,7 @@ export default function VideoEditor() {
|
||||
</p>
|
||||
{isRenderingAudio ? (
|
||||
<p className="mt-1 text-[11px] text-muted-foreground/70">
|
||||
Processing audio with speed/overlay edits
|
||||
{t("editor.export.processingAudioEdits", "Processing audio with speed/overlay edits")}
|
||||
</p>
|
||||
) : exportRenderSpeedLabel ? (
|
||||
<p className="mt-1 text-[11px] text-muted-foreground/70">
|
||||
|
||||
@@ -1149,17 +1149,8 @@ export class AudioProcessor {
|
||||
const source = await resolveMediaElementSource(url);
|
||||
try {
|
||||
const media = document.createElement("video");
|
||||
media.src = source.src;
|
||||
media.preload = "metadata";
|
||||
|
||||
if (
|
||||
Number.isFinite(media.duration) &&
|
||||
media.readyState >= HTMLMediaElement.HAVE_METADATA
|
||||
) {
|
||||
const duration = media.duration;
|
||||
media.src = "";
|
||||
return duration;
|
||||
}
|
||||
media.src = source.src;
|
||||
|
||||
return await new Promise<number>((resolve, reject) => {
|
||||
const timeout = setTimeout(() => {
|
||||
|
||||
@@ -434,6 +434,11 @@ export class ModernVideoExporter {
|
||||
"muxing queued video chunks",
|
||||
);
|
||||
|
||||
// Surface muxing errors before proceeding with finalization
|
||||
if (this.encoderError) {
|
||||
throw this.encoderError;
|
||||
}
|
||||
|
||||
if (nativeAudioPlan.audioMode !== "none" && !shouldUseFfmpegAudioFallback && !this.cancelled) {
|
||||
const demuxer = this.streamingDecoder.getDemuxer();
|
||||
if (
|
||||
@@ -1399,8 +1404,9 @@ export class ModernVideoExporter {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Muxing error:", error);
|
||||
const muxingError = error instanceof Error ? error : new Error(String(error));
|
||||
if (!this.encoderError) {
|
||||
this.encoderError = error instanceof Error ? error : new Error(String(error));
|
||||
this.encoderError = muxingError;
|
||||
}
|
||||
this.cancelled = true;
|
||||
}
|
||||
|
||||
@@ -293,6 +293,11 @@ export class VideoExporter {
|
||||
"muxing queued video chunks",
|
||||
);
|
||||
|
||||
// Surface muxing errors before proceeding with finalization
|
||||
if (this.encoderError) {
|
||||
throw this.encoderError;
|
||||
}
|
||||
|
||||
if (hasAudio && !shouldUseFfmpegAudioFallback && !this.cancelled) {
|
||||
const demuxer = this.streamingDecoder.getDemuxer();
|
||||
if (demuxer || hasAudioRegions || hasSourceAudioFallback) {
|
||||
@@ -979,6 +984,11 @@ export class VideoExporter {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Muxing error:", error);
|
||||
const muxingError = error instanceof Error ? error : new Error(String(error));
|
||||
if (!this.encoderError) {
|
||||
this.encoderError = muxingError;
|
||||
}
|
||||
this.cancelled = true;
|
||||
}
|
||||
});
|
||||
this.encodeQueue--;
|
||||
|
||||
Reference in New Issue
Block a user