Skip to content

OpenReel Video - Professional browser-based video editor. Open source CapCut alternative. 100% browser-based, no installation, no cloud uploads, no watermarks.

TypeScript

fix(audio): apply speed to audio playback and remove duplicate speed section

Augustus Otub9dbb9098efa
diff --git a/apps/web/src/components/editor/InspectorPanel.tsx b/apps/web/src/components/editor/InspectorPanel.tsx
index 9690299f..4d0a4e90 100644
--- a/apps/web/src/components/editor/InspectorPanel.tsx
+++ b/apps/web/src/components/editor/InspectorPanel.tsx
@@ -20,7 +20,6 @@ import {
VideoEffectsSection,
GreenScreenSection,
PiPSection,
- SpeedRampSection,
MaskSection,
ColorGradingSection,
AudioEffectsSection,
@@ -1051,12 +1050,6 @@ export const InspectorPanel: React.FC = () => {
</Section>
)}
- {showVideoControls && selectedClip && (
- <Section title="Speed & Time" defaultOpen={false}>
- <SpeedRampSection clip={selectedClip} />
- </Section>
- )}
-
{showVideoControls && (
<Section title="Masking" sectionId="masking" defaultOpen={false}>
<MaskSection clipId={clipId} />
diff --git a/apps/web/src/components/editor/Preview.tsx b/apps/web/src/components/editor/Preview.tsx
index 29a3384c..c5c1a293 100644
--- a/apps/web/src/components/editor/Preview.tsx
+++ b/apps/web/src/components/editor/Preview.tsx
@@ -905,6 +905,7 @@ export const Preview: React.FC = () => {
volume: audioClip.volume ?? 1,
pan: 0,
effects: enabledEffects,
+ speed: audioClip.speed ?? 1,
});
}
}
@@ -990,6 +991,7 @@ export const Preview: React.FC = () => {
volume: clip.volume ?? 1,
pan: 0,
effects: audioEffects,
+ speed: clip.speed ?? 1,
});
}
}
@@ -1914,6 +1916,7 @@ export const Preview: React.FC = () => {
volume: 1,
pan: 0,
effects: [],
+ speed: audioClip.speed ?? 1,
});
}
}
diff --git a/packages/core/src/audio/realtime-audio-graph.ts b/packages/core/src/audio/realtime-audio-graph.ts
index c0b94793..07dfd61b 100644
--- a/packages/core/src/audio/realtime-audio-graph.ts
+++ b/packages/core/src/audio/realtime-audio-graph.ts
@@ -14,6 +14,7 @@ export interface AudioClipSchedule {
volume: number;
pan: number;
effects: Effect[];
+ speed: number;
}
export interface TrackConfig {
@@ -482,6 +483,7 @@ export class RealtimeAudioGraph {
const source = this.audioContext.createBufferSource();
source.buffer = schedule.audioBuffer;
+ source.playbackRate.value = schedule.speed;
const clipGain = this.audioContext.createGain();
clipGain.gain.value = schedule.volume;
diff --git a/packages/core/src/playback/playback-controller.ts b/packages/core/src/playback/playback-controller.ts
index d751ce16..aa5f518d 100644
--- a/packages/core/src/playback/playback-controller.ts
+++ b/packages/core/src/playback/playback-controller.ts
@@ -576,6 +576,7 @@ export class PlaybackController {
volume: clip.volume,
pan: 0,
effects: clip.audioEffects || [],
+ speed: clip.speed ?? 1,
});
}
}