{"schemaVersion":1,"id":"recommended.sm-export-audio","version":"1.0.0","name":"Export audio workflow","description":"An editable production workflow using Export audio v2.0.0.","stages":[{"id":"main","blockId":"sm.export-audio","version":"2.0.0","label":"Export audio"}],"connections":[],"packages":[{"manifest":{"schemaVersion":1,"sdkVersion":"0.1.0","id":"sm.export-audio","version":"2.0.0","name":"Export audio","description":"Render a reviewed timeline to a downloadable audio file, then explicitly save it as a connected media asset.","kind":"task","runtime":"javascript","entry":"src/run.js","license":"MIT","provenance":{"notice":"Original source (authorship declared by the packager)\nLicense: MIT\nChanges: Original implementation declared by the packager; no reused repository or dependency code.\nFiles: LICENSE, src/run.js\n\nMIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","portableSources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}]},"inputs":{"input":{"type":"timeline","primary":true,"semantic":"timeline","required":false,"description":"An explicitly connected timeline to render.","sources":["user","upstream"]},"renderFps":{"type":"text","semantic":"render_fps","required":false,"default":"30","description":"Render frames per second.","sources":["user","default"]},"renderResolution":{"type":"text","semantic":"render_resolution","required":false,"default":"1080","description":"Output height in pixels.","sources":["user","default"]},"renderQuality":{"type":"text","semantic":"render_quality","required":false,"default":"high","description":"Output quality.","sources":["user","default"]},"projectTimeline":{"type":"timeline","context":"timeline","semantic":"timeline","required":false,"description":"Current project timeline when no Block is connected.","sources":["project"]}},"outputs":{"mediaAction":{"type":"approval","role":"portable_media_action","semantic":"portable_media_action","description":"A bounded render request for explicit review."},"output":{"type":"audio","semantic":"rendered_audio","required":false,"description":"The selected durable audio asset from the completed render."}},"permissions":{"project":["context.timeline.read"],"network":[],"filesystem":[],"secrets":[],"actions":["final.render"]},"ui":[{"control":"select","port":"renderFps","options":["24","30","60"]},{"control":"select","port":"renderResolution","options":["720","1080","2160"]},{"control":"select","port":"renderQuality","options":["low","medium","high"]}],"platforms":{"phone":{"supported":true},"browser":{"supported":true},"desktop":{"supported":true}}},"code":"const timeline=JSON.parse(JSON.stringify(input.input||input.projectTimeline||{}));\nconst clips=Array.isArray(timeline.clips)?timeline.clips:[];\nconst audio=Array.isArray(timeline.audioItems)?timeline.audioItems:[];\nconst overlays=[...(timeline.captions||[]),...(timeline.textOverlays||[]),...(timeline.effects||[])];\nif(!clips.length&&!audio.length)throw new Error('Add playable timeline media before exporting.');\nconst end=item=>Number(item.start||0)+Number(item.duration||0);\nconst targetDuration=Math.max(0,Number(timeline.targetDuration)||0,...clips.map(end),...audio.map(end),...overlays.map(end));\nif(!Number.isFinite(targetDuration)||targetDuration<=0||targetDuration>21600)throw new Error('The export duration must be between 0 and 21600 seconds.');\nconst settings={fps:Number(input.renderFps||30),resolution:Number(input.renderResolution||1080),quality:String(input.renderQuality||'high')};\nif(![24,30,60].includes(settings.fps)||![720,1080,2160].includes(settings.resolution)||!['low','medium','high'].includes(settings.quality))throw new Error('Choose approved export settings.');\nreturn {mediaAction:{schemaVersion:1,kind:'stillmade.media-action',operation:'final.render',request:{schemaVersion:1,kind:'audio',timeline:{...timeline,clips,audio,overlays,targetDuration},settings,source:{id:'sm.export-audio',version:'2.0.0'}},resultPort:'output'}};\n","tests":[{"name":"Prepares an exact render request without rendering or uploading","input":{"input":{"schemaVersion":1,"activeTimelineId":"timeline-1","clips":[{"id":"clip-1","trackId":"video","start":0,"duration":2,"url":"/api/media/owner/sample.mp4"}],"audioItems":[],"captions":[],"textOverlays":[],"effects":[]}},"expected":{"mediaAction":{"schemaVersion":1,"kind":"stillmade.media-action","operation":"final.render","request":{"schemaVersion":1,"kind":"audio","timeline":{"schemaVersion":1,"activeTimelineId":"timeline-1","clips":[{"id":"clip-1","trackId":"video","start":0,"duration":2,"url":"/api/media/owner/sample.mp4"}],"audioItems":[],"captions":[],"textOverlays":[],"effects":[],"audio":[],"overlays":[],"targetDuration":2},"settings":{"fps":30,"resolution":1080,"quality":"high"},"source":{"id":"sm.export-audio","version":"2.0.0"}},"resultPort":"output"}}},{"name":"Uses reviewed render settings for a longer timeline","input":{"input":{"schemaVersion":1,"activeTimelineId":"timeline-1","clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"/api/media/owner/sample.mp4"}],"audioItems":[],"captions":[],"textOverlays":[],"effects":[]},"renderFps":"60","renderResolution":"720","renderQuality":"medium"},"expected":{"mediaAction":{"schemaVersion":1,"kind":"stillmade.media-action","operation":"final.render","request":{"schemaVersion":1,"kind":"audio","timeline":{"schemaVersion":1,"activeTimelineId":"timeline-1","clips":[{"id":"clip-1","trackId":"video","start":0,"duration":4,"url":"/api/media/owner/sample.mp4"}],"audioItems":[],"captions":[],"textOverlays":[],"effects":[],"audio":[],"overlays":[],"targetDuration":4},"settings":{"fps":60,"resolution":720,"quality":"medium"},"source":{"id":"sm.export-audio","version":"2.0.0"}},"resultPort":"output"}}},{"name":"Uses the current project timeline when no Block is connected","input":{"projectTimeline":{"schemaVersion":1,"activeTimelineId":"timeline-1","clips":[{"id":"clip-1","trackId":"video","start":0,"duration":2,"url":"/api/media/owner/sample.mp4"}],"audioItems":[],"captions":[],"textOverlays":[],"effects":[]}},"expected":{"mediaAction":{"schemaVersion":1,"kind":"stillmade.media-action","operation":"final.render","request":{"schemaVersion":1,"kind":"audio","timeline":{"schemaVersion":1,"activeTimelineId":"timeline-1","clips":[{"id":"clip-1","trackId":"video","start":0,"duration":2,"url":"/api/media/owner/sample.mp4"}],"audioItems":[],"captions":[],"textOverlays":[],"effects":[],"audio":[],"overlays":[],"targetDuration":2},"settings":{"fps":30,"resolution":1080,"quality":"high"},"source":{"id":"sm.export-audio","version":"2.0.0"}},"resultPort":"output"}}}],"portable":{"format":"stillmade-block/1","dependencies":[],"sources":[{"kind":"original","license":"MIT","paths":["LICENSE","src/run.js"],"evidence":["upstream/0/LICENSE","upstream/0/src/run.js"],"changes":"Original implementation declared by the packager; no reused repository or dependency code."}],"files":{"upstream/0/LICENSE":"MIT License\n\nCopyright (c) 2026 StillMade contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","upstream/0/src/run.js":"const timeline=JSON.parse(JSON.stringify(input.input||input.projectTimeline||{}));\nconst clips=Array.isArray(timeline.clips)?timeline.clips:[];\nconst audio=Array.isArray(timeline.audioItems)?timeline.audioItems:[];\nconst overlays=[...(timeline.captions||[]),...(timeline.textOverlays||[]),...(timeline.effects||[])];\nif(!clips.length&&!audio.length)throw new Error('Add playable timeline media before exporting.');\nconst end=item=>Number(item.start||0)+Number(item.duration||0);\nconst targetDuration=Math.max(0,Number(timeline.targetDuration)||0,...clips.map(end),...audio.map(end),...overlays.map(end));\nif(!Number.isFinite(targetDuration)||targetDuration<=0||targetDuration>21600)throw new Error('The export duration must be between 0 and 21600 seconds.');\nconst settings={fps:Number(input.renderFps||30),resolution:Number(input.renderResolution||1080),quality:String(input.renderQuality||'high')};\nif(![24,30,60].includes(settings.fps)||![720,1080,2160].includes(settings.resolution)||!['low','medium','high'].includes(settings.quality))throw new Error('Choose approved export settings.');\nreturn {mediaAction:{schemaVersion:1,kind:'stillmade.media-action',operation:'final.render',request:{schemaVersion:1,kind:'audio',timeline:{...timeline,clips,audio,overlays,targetDuration},settings,source:{id:'sm.export-audio',version:'2.0.0'}},resultPort:'output'}};\n"},"lineage":{"parents":[],"changes":"Packaged original Block source for StillMade."}}}],"license":"MIT"}