Skip to main content

Text and captions Preview

Titles​

Add text as a clip on a visual track, then style it through its properties (font, size, colour, weight, background and more) or with a built-in style.

let titles = try editor.apply(edit: .addTrack(kind: .visual, magnetic: false))
let title = try editor.apply(edit: .insertText(
track: titles, startUs: 0, durationUs: 3_000_000, text: "Summer in Lisbon"))

let style = editor.textStylePresets().first!
_ = try editor.apply(edit: .applyStylePreset(clips: [title], preset: style.id))

Captions​

Add captions from your speech-to-text results in one call. Word timings are optional; with them, word-by-word animations such as karaoke follow the speech.

let lines = [
CaptionSegmentInfo(text: "Welcome to the show", startUs: 0, endUs: 1_800_000, words: [
CaptionWordInfo(text: "Welcome", startUs: 0, endUs: 500_000),
CaptionWordInfo(text: "to", startUs: 500_000, endUs: 700_000),
CaptionWordInfo(text: "the", startUs: 700_000, endUs: 900_000),
CaptionWordInfo(text: "show", startUs: 900_000, endUs: 1_800_000),
]),
]
let set = try editor.apply(edit: .insertCaptions(track: nil, segments: lines, stylePreset: nil))
  • Each line becomes a text clip, and together they form one caption set: a style or animation applied to one caption applies to all of them.
  • Lines that overlap in time go onto extra caption tracks.
  • Splitting a caption divides its words between the two halves.

Text animations​

Text animates per letter, word or line. There are four kinds: In, Out, Loop and Caption (e.g. karaoke or highlight, for captions with word timings). Setting an animation replaces the clip's animation of that kind only; setting none removes it.

let karaoke = editor.textAnimationPresets().first { $0.kind == .caption }!
_ = try editor.apply(edit: .setTextAnimation(clips: [caption], kind: .caption, preset: karaoke.id))

Fonts Stable​

Text can use the device's fonts and fonts you register. Register your fonts at start-up, before opening projects that use them; registering returns the font's family names.

PlatformRegisterList for a picker
iOSregisterFont(path:)fontFamilies()
AndroidregisterFont(path)fontFamilies()
React NativeregisterFont(path)fontFamilies()
Webfonts option, or editor.loadFont(font)editor.fontFamilies()

TTF, OTF and TTC files work.