-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Issue Summary
Audio clips with valid, accessible URLs throw "Invalid audio source" error when included in the initial edit.loadEdit() call, but work correctly when added programmatically using edit.addClip() after the edit loads.
Expected Behavior
Audio clips should load successfully when included in the edit configuration passed to edit.loadEdit(), just like video and image clips do.
Actual Behavior
When an audio clip is included in the initial edit configuration, loadEdit() throws an error:
Error: Invalid audio source 'https://cdn.jsdelivr.net/npm/@audio-samples/[email protected]/audio/A0v16.mp3'.
However, the same audio clip works perfectly when:
- Loading the edit without the audio track
- Then adding the audio clip programmatically using
edit.addClip()
Steps to Reproduce
- Create an edit configuration with an audio clip:
const editConfig = {
timeline: {
tracks: [
{
clips: [
{
fit: 'none',
start: 0,
length: 10,
asset: {
type: 'audio',
src: 'https://cdn.jsdelivr.net/npm/@audio-samples/[email protected]/audio/A0v16.mp3',
volume: 0.2,
effect: 'none',
},
},
],
},
],
},
output: {
format: 'mp4',
fps: 25,
size: { width: 1080, height: 1920 },
},
};
- Try to load the edit:
const edit = new Edit(editConfig.output.size, '#000000');
await edit.load();
await edit.loadEdit(editConfig); // ❌ Throws "Invalid audio source" error
- Workaround that works:
// Load without audio track
const editWithoutAudio = {
...editConfig,
timeline: {
tracks: editConfig.timeline.tracks.filter(track =>
!track.clips.some(clip => clip.asset.type === 'audio')
),
},
};
await edit.loadEdit(editWithoutAudio); // ✅ Works
// Add audio clip programmatically
const audioClip = editConfig.timeline.tracks[0].clips[0];
edit.addClip(0, audioClip); // ✅ Works
Technical Analysis
No response
Possible Solutions
No response
Tested Environment
Package: @shotstack/[email protected]
Browser: Chrome (latest)
OS: macOS
Framework: Nuxt 4.2.2 / Vue 3
TypeScript: 5.9.3
Additional Context
No response
Metadata
Metadata
Assignees
Labels
No labels