React Native API
Package @nitrakit/react-native. Times are microseconds; ids are strings. Editor calls throw
on invalid input.
Functions
setLicense(key): LicenseStatus | Installs your license key. |
licenseInfo(): LicenseStatus | The installed license. |
createEditor(width, height, fps = 30): Editor | A new empty project. |
openEditor(json): Editor | Reopens a saved project. |
filesDir(): string | Your app's folder for media. |
importFile(uri, name?): string | Turns a picked file (content://, file://) into a path for addMedia. |
setMediaResolver(resolve) | Your lookup from a media id to a URL or local path. |
setLocale(tag?): string | The editor's language, the device's by default; returns the one used. |
availableLocales(): string[] | Built-in languages. |
localeIsRtl(): boolean | The current language is right to left. |
setStrings(strings) | Your own wording: message id → text. |
registerFont(path): string[] | Adds a font file; returns its family names. |
fontFamilies(): string[] | Fonts text can use. |
iconNames(): string[] | The built-in icon names. |
fontPreview(family, heightPx, path) | Writes a PNG of a family's name in that font, for picker rows. |
easingNames(): string[] | Named easings. |
NitrakitPreview
| Prop | |
|---|---|
editor | The editor to show. |
canvas? | Layer handles on the preview. Default true. |
onPosition?(us) | Playback position. |
onPlaying?(playing) | Playback started or stopped. |
Ref (PreviewHandle): play(), pause(), seek(us).
NitrakitEditor
| Prop | |
|---|---|
editor | The editor to show. |
chrome? | false shows only the timeline. Default true. |
onRequest?(request) | { kind, clip, property }. Return (or resolve to) the answer, null (cancelled) or undefined (built-in picker). |
onSelected?(clip) | The selected clip; "" for none. |
onFullscreen?() | The fullscreen button was tapped. |
theme? | The editor's look; see Theme. |
hiddenMenuItems?, menuItems? | See Tools and menus. |
icons? | Icon name → SVG; see Icons. |
onCustomItem?(id) | One of your tools was tapped. |
stickerPacks? | Your sticker packs; see Stickers. |
fonts? | The font panel's list; see Fonts. |
Request kinds: addMedia, addOverlay, addAudio, addSticker, chooseFilter,
chooseFont, chooseColor, editText, chooseTextStyle.
Answers: { source }, { text }, { color: { r, g, b, a } } (0–1), { effect } or
{ stylePreset }.
Editor
toJson() | The project as JSON. |
addMedia(id, path, name) | Adds a local file under your media id: { source, kind, durationUs, width, height, hasAudio }. |
loadMedia() | After opening: makes the project's media available (device, else your resolver). |
setMediaProgress(id, fraction?) | Progress on a media id's clips, e.g. while uploading; omit when done. |
retryMedia(id?) | Resolves a media id (or every missing one) again. |
mediaIds() | The media ids the project uses. |
addTrack(kind, magnetic) | visual, audio or effects; returns the track id. |
insertMedia(track, source, startUs, sourceInUs, durationUs) | Returns the clip id. |
insertText(track, startUs, durationUs, text) | Returns the clip id. |
undo(), redo(), canUndo(), canRedo() | |
setListener(fn) | fn(canUndo, canRedo, changes) after every change. |
exportSettings(shortSide?) | { width, height, fpsNum, fpsDen, videoBitrate, audioBitrate }. |
exportVideo(path, settings, onProgress): Promise<void> | |
cancelExport() | |
move, trimStart, trimEnd, trimRange, split, duplicate, remove, setSpeed, moveToNewTrack | Clip edits. |
removeTrack, setTrackFlags | |
timeline(), clipText(clip), selectedClips(), selectClips(clips) | |
properties, getProperty, setProperty, resetProperty | |
setKeyframe, removeKeyframe, keyframes, setKeyframeEasing | |
effectCatalog, addEffect, removeEffect, setTransition | |
animationPresets, setAnimation | |
textStylePresets, applyStylePreset, textAnimationPresets, setTextAnimation, insertCaptions | |
link, unlink | |
beginSession, commitSession, cancelSession | One undo step, or revert. |
LicenseStatus
state (whether the key applies to this app, e.g. valid, development or wrong app), the team, and problems saying what doesn't match.