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.
- iOS
- Android
- React Native
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))
val titles = editor.apply(Edit.AddTrack(TrackKind.VISUAL, false))
val title = editor.apply(Edit.InsertText(titles, 0, 3_000_000, "Summer in Lisbon"))
val style = editor.textStylePresets().first()
editor.apply(Edit.ApplyStylePreset(listOf(title), style.id))
const titles = editor.addTrack('visual', false)
const title = editor.insertText(titles, 0, 3_000_000, 'Summer in Lisbon')
const [style] = editor.textStylePresets()
editor.applyStylePreset([title], 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.
- iOS
- Android
- React Native
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))
val lines = listOf(
CaptionSegmentInfo("Welcome to the show", 0, 1_800_000, listOf(
CaptionWordInfo("Welcome", 0, 500_000),
CaptionWordInfo("to", 500_000, 700_000),
CaptionWordInfo("the", 700_000, 900_000),
CaptionWordInfo("show", 900_000, 1_800_000),
)),
)
val set = editor.apply(Edit.InsertCaptions(null, lines, null))
const set = editor.insertCaptions([
{
text: 'Welcome to the show',
startUs: 0,
endUs: 1_800_000,
words: [
{ text: 'Welcome', startUs: 0, endUs: 500_000 },
{ text: 'to', startUs: 500_000, endUs: 700_000 },
{ text: 'the', startUs: 700_000, endUs: 900_000 },
{ text: 'show', startUs: 900_000, endUs: 1_800_000 },
],
},
])
- 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.
- iOS
- Android
- React Native
let karaoke = editor.textAnimationPresets().first { $0.kind == .caption }!
_ = try editor.apply(edit: .setTextAnimation(clips: [caption], kind: .caption, preset: karaoke.id))
val karaoke = editor.textAnimationPresets().first { it.kind == TextAnimationKind.CAPTION }
editor.apply(Edit.SetTextAnimation(listOf(caption), TextAnimationKind.CAPTION, karaoke.id))
const karaoke = editor.textAnimationPresets().find((o) => o.kind === 'caption')!
editor.setTextAnimation([caption], 'caption', 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.
| Platform | Register | List for a picker |
|---|---|---|
| iOS | registerFont(path:) | fontFamilies() |
| Android | registerFont(path) | fontFamilies() |
| React Native | registerFont(path) | fontFamilies() |
| Web | fonts option, or editor.loadFont(font) | editor.fontFamilies() |
TTF, OTF and TTC files work.