Android API
Package dev.nitrakit; views in dev.nitrakit.ui. Times are microseconds (Long); ids are
String. Failing calls throw EditorError.
Functions
NitrakitLicense.set(context, key): LicenseInfo Stable | Installs your license key. |
NitrakitLicense.info(): LicenseInfo Stable | The installed license. |
setLocale(tag): String Stable | The editor's language; returns the one used. |
availableLocales(): List<String> Stable | Built-in languages. |
localeIsRtl(): Boolean Stable | The current language is right to left. |
setStrings(json) Stable | Your own wording: a JSON object of message id → text. |
registerFont(path): List<String> Stable | Adds a font file; returns its family names. |
fontFamilies(): List<String> Stable | Fonts text can use. |
iconNames(): List<String> Stable | The built-in icon names. |
fontPreview(family, heightPx, path) Preview | Writes a PNG of a family's name in that font, for picker rows. |
easingNames(): List<String> Preview | Named easings. |
NitrakitMedia.resolve Stable | Your suspend lookup from a media id to MediaLocation.Remote(url) or Local(file). |
NitrakitPreviewView Stable
NitrakitPreviewView(context) | |
editor: Editor? | The editor to show; null releases it. |
player: Player? | Playback: play(), pause(), seek(timeUs), positionUs(), isPlaying(), setVolume(volume). |
onPosition: ((Long) -> Unit)? | Playback position, on the main thread. |
onPlaying: ((Boolean) -> Unit)? | Playback started or stopped. |
onPlayer: ((Player) -> Unit)? | A new player is ready, e.g. after returning from the background. |
onError: ((Throwable) -> Unit)? | The view couldn't start. |
NitrakitTimelineView Stable
NitrakitTimelineView(context) | |
editor: Editor? | The editor to show; null releases it. |
timeline: Timeline? | setChrome(visible), select(clip). |
theme: EditorTheme? | The editor's look; see Theme. |
hideMenuItems(ids), addMenuItem(item), removeMenuItem(id) | See Tools and menus. |
setIcon(name, svg) | See Icons. |
onCustomItem: ((String) -> Unit)? | One of your tools was tapped. |
stickerPacks: List<StickerPack> | Your sticker packs; see Stickers. |
fonts: List<String> | The font panel's list; see Fonts. |
onRequest: (suspend (EditorRequest) -> RequestResponse?)? | Your pickers: return the answer, Cancel, or null for the built-in picker. |
onSelected: ((String) -> Unit)? | The selected clip; "" for none. |
onFullscreen: (() -> Unit)? | The fullscreen button was tapped. |
onError: ((Throwable) -> Unit)? | The view couldn't start. |
EditorRequest: kind, clip (the selected clip, "" if none), property (for colours).
RequestType: ADD_MEDIA, ADD_OVERLAY, ADD_AUDIO, ADD_STICKER, CHOOSE_FILTER,
CHOOSE_FONT, CHOOSE_COLOR, EDIT_TEXT, CHOOSE_TEXT_STYLE.
RequestResponse: Source(id), Text(value), Color(r, g, b, a), Effect(id),
StylePreset(id), Cancel.
Editor (AutoCloseable)
Editor(width, height, fpsNum, fpsDen) Stable | A new empty project. |
Editor(json) Stable | Reopens a saved project. |
toJson(): String Stable | The project as JSON. |
addMedia(file, id, name): MediaInfo Stable | Adds a local file under your media id: source, kind, durationUs, width, height, hasAudio. |
loadMedia() Stable | After opening: makes the project's media available (device, else NitrakitMedia.resolve). |
setMediaProgress(id, fraction) Stable | Progress on a media id's clips, e.g. while uploading; null when done. |
retryMedia(id) Stable | Resolves a media id (or every missing one) again. |
mediaIds(): List<String> Stable | The media ids the project uses. |
apply(edit): String Stable with AddTrack, InsertMedia, InsertText | Returns the new id. |
apply(edit) with any other Edit Preview | See Editing from code. |
undo(), redo(): Boolean Stable | |
setListener(listener) Stable | changed(canUndo, canRedo, changes) after every change. |
exportSettings(), exportSettingsFor(shortSide) Stable | |
export(path, settings, listener): ExportJob Stable | ExportJob.cancel(), close(); ExportListener.progress / finished. |
close() Stable | Releases the editor. |
selectedClips(), selectClips(clips) Preview | |
timeline(): TimelineView Preview | Tracks and clips, for your own UI. |
trimLimits(clip) Preview | |
properties(clip), `property`(clip, path, atUs), setProperty(…), resetProperty(…) Preview | |
setKeyframe(…), removeKeyframe(…), keyframes(…) Preview | |
addEffect(clip, kind), removeEffect(clip, effect) Preview | |
effectCatalog(), animationPresets(), textStylePresets(), textAnimationPresets() Preview | |
beginSession(), commitSession(), cancelSession() Preview | One undo step, or revert. |
LicenseInfo Stable
state (VALID, DEVELOPMENT, EXPIRED, WRONG_APP, INVALID, MISSING), org, id,
trial, expires, updatesUntil, maxExportSeconds (0 = no limit), watermark,
problems.