importMedia
Adds a video or audio file from disk to an OpenScreen project's media library without placing it on the timeline, returning the asset ID and duration.
Instructions
Add a video or audio file from disk to the project's media, as the editor's Import does. It does not place it on the timeline. An audio file is then played by a track you lay with addAudio. A video becomes the project's footage when it has none yet (a project createProject made without a video): replaceTimeline then lays it out. Returns the new assetId and the file's durationSec, null when OpenScreen could not read it (the editor reads it again when it opens the project).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | What the file is. Default: audio for an audio-only extension, video otherwise, so pass audio for a .webm that holds only sound. | |
| path | Yes | Absolute path of the file. Video: .mp4, .mov, .m4v, .webm, .mkv, .avi, .wmv. Audio: .mp3, .wav, .m4a, .aac, .flac, .ogg, .oga, .opus, .webm. | |
| label | No | Its name in the project's media. Default: the file name. | |
| projectId | No | The project to act on, from listProjects. Omit it only for the project open in the OpenScreen editor, which works only while the app runs. |