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): LicenseInfo StableInstalls your license key.
NitrakitLicense.info(): LicenseInfo StableThe installed license.
setLocale(tag): String StableThe editor's language; returns the one used.
availableLocales(): List<String> StableBuilt-in languages.
localeIsRtl(): Boolean StableThe current language is right to left.
setStrings(json) StableYour own wording: a JSON object of message id → text.
registerFont(path): List<String> StableAdds a font file; returns its family names.
fontFamilies(): List<String> StableFonts text can use.
iconNames(): List<String> StableThe built-in icon names.
fontPreview(family, heightPx, path) PreviewWrites a PNG of a family's name in that font, for picker rows.
easingNames(): List<String> PreviewNamed easings.
NitrakitMedia.resolve StableYour 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) StableA new empty project.
Editor(json) StableReopens a saved project.
toJson(): String StableThe project as JSON.
addMedia(file, id, name): MediaInfo StableAdds a local file under your media id: source, kind, durationUs, width, height, hasAudio.
loadMedia() StableAfter opening: makes the project's media available (device, else NitrakitMedia.resolve).
setMediaProgress(id, fraction) StableProgress on a media id's clips, e.g. while uploading; null when done.
retryMedia(id) StableResolves a media id (or every missing one) again.
mediaIds(): List<String> StableThe media ids the project uses.
apply(edit): String Stable with AddTrack, InsertMedia, InsertTextReturns the new id.
apply(edit) with any other Edit PreviewSee Editing from code.
undo(), redo(): Boolean Stable
setListener(listener) Stablechanged(canUndo, canRedo, changes) after every change.
exportSettings(), exportSettingsFor(shortSide) Stable
export(path, settings, listener): ExportJob StableExportJob.cancel(), close(); ExportListener.progress / finished.
close() StableReleases the editor.
selectedClips(), selectClips(clips) Preview
timeline(): TimelineView PreviewTracks 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() PreviewOne 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.