Skip to main content

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): LicenseInfoInstalls your license key.
NitrakitLicense.info(): LicenseInfoThe installed license.
setLocale(tag): StringThe editor's language; returns the one used.
availableLocales(): List<String>Built-in languages.
localeIsRtl(): BooleanThe current language is right to left.
setStrings(json)Your own wording: a JSON object of message id → text.
registerFont(path): List<String>Adds a font file; returns its family names.
fontFamilies(): List<String>Fonts text can use.
iconNames(): List<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(): List<String>Named easings.
NitrakitMedia.resolveYour suspend lookup from a media id to MediaLocation.Remote(url) or Local(file).

NitrakitPreviewView​

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​

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)A new empty project.
Editor(json)Reopens a saved project.
toJson(): StringThe project as JSON.
addMedia(file, id, name): MediaInfoAdds a local file under your media id: source, kind, durationUs, width, height, hasAudio.
loadMedia()After opening: makes the project's media available (device, else NitrakitMedia.resolve).
setMediaProgress(id, fraction)Progress on a media id's clips, e.g. while uploading; null when done.
retryMedia(id)Resolves a media id (or every missing one) again.
mediaIds(): List<String>The media ids the project uses.
apply(edit): String with AddTrack, InsertMedia, InsertTextReturns the new id.
apply(edit) with any other EditSee Editing from code.
undo(), redo(): Boolean
setListener(listener)changed(canUndo, canRedo, changes) after every change.
exportSettings(), exportSettingsFor(shortSide)
export(path, settings, listener): ExportJobExportJob.cancel(), close(); ExportListener.progress / finished.
close()Releases the editor.
selectedClips(), selectClips(clips)
timeline(): TimelineViewTracks and clips, for your own UI.
trimLimits(clip)
properties(clip), `property`(clip, path, atUs), setProperty(…), resetProperty(…)
setKeyframe(…), removeKeyframe(…), keyframes(…)
addEffect(clip, kind), removeEffect(clip, effect)
effectCatalog(), animationPresets(), textStylePresets(), textAnimationPresets()
beginSession(), commitSession(), cancelSession()One undo step, or revert.

LicenseInfo​

state (whether the key applies to this app, e.g. valid, development or wrong app), the team, and problems saying what doesn't match.