Recording a show
Recording mode records a slide show as a track: one timestamped stream of what happened while presenting (slides and builds, the cursor and laser, ink, text typed live, zoom, spotlight, media). The host records its own audio or video next to it; a replay re-renders the show from the track in sync with that media, so a recorded lecture stays sharp at any size, weighs less than its audio, and stays searchable (markers, slide changes).
import { motionUiPlugin, recordingPlugin } from '@nextgensoftwares/folio-plugin-slides-motion';
const deck = createDeckEditor({
presentation,
plugins: [
motionUiPlugin(),
recordingPlugin({
onState: (s) => mic[s === 'recording' ? 'start' : s === 'paused' ? 'pause' : 'stop'](),
onTrack: (track) => save(track, mic.blob()),
webcam: cameraStream, // optional bubble
}),
],
});Record on the Slide Show tab (or present.record) starts the show in the recording layout and opens the presenter view, which holds Record, Pause, Resume and Stop with the recorded time (Alt+R records, pauses and resumes). Ending the show while recording stops it; the track goes to onTrack either way.
What is recorded
ShowTrack = { format: 'folio-show-track', version: 1, durationMs, size, events }. Each event is { t, k, ... }: t in ms from the start of the recording (the media's t = 0; pauses are cut out, as from the media), positions 0..1 of the slide (x of its width, y of its height).
k | Fields | |
|---|---|---|
show | s: { index, from, slideStart, steps[], triggers, blank, ended } | the show's whole state, its times in track time: a replay restores it, so builds, transitions and triggers play as they did |
nav.slide | slideIndex | the slide changed |
pointer, pointer.hide | x, y, laser? | the cursor or the laser (~30 Hz, the last sample always lands) |
ink.start, ink.point, ink.end, ink.remove, ink.clear | id, slideIndex, color, w, hl?; id, x, y; id; id; scope, slideIndex? | pen and highlighter strokes as they're drawn, erased, cleared (w: a fraction of the slide width) |
text, text.box, typing | slideIndex, shape, text; slideIndex, shape, x, y, w, h; slideIndex, shape | null | text typed live into a shape (its whole text), a text box added on the slide, the typing indicator |
zoom, spotlight | x, y, scale; x, y, r | zoom (1: off) and spotlight (r 0: off; r a fraction of the slide height) |
media | slideIndex, shape, verb, at | a video or audio shape played, paused, stopped (at: its position, s) |
overlay | cursor?, ink?, webcam? | overlays shown or hidden in the recording |
marker | label | a host's chapter mark |
The names and shapes that overlap common lecture timelines (nav.slide, ink.*, pointer, marker, 0..1 coordinates) are the same, so an existing timeline store and its windowing take tracks unchanged.
The recording layout and overlays
The stage is a fixed-aspect box (16:9 by default) with the slide filling it, a safe area (4% of the height) holding the webcam bubble, and overlays styled for video:
| Key | Tool | |
|---|---|---|
| Ctrl+L, Ctrl+P, Ctrl+I, Ctrl+E | laser, pen, highlighter, eraser | as in a plain show |
| T | type | a click adds a text box whose first line starts at the click (see below); Esc or a click elsewhere finishes |
| S | spotlight | dims the slide around the pointer; the wheel sizes it |
| Z | zoom | click to zoom in on a point (2×, the wheel adjusts), click again or Esc to zoom out |
| C | cursor | the drawn cursor on / off (the OS cursor never shows on the stage) |
| V | webcam | the webcam bubble on / off |
| O | clean shot | every overlay hidden |
The tools work from the presenter view's current slide as well as from the stage: the pointer there is the recording's pointer (the laser and the spotlight follow it, the laser with a short fading trail), a click types, zooms or plays a trigger, the wheel sizes the spotlight or the zoom. The presenter view marks the zoomed area and the spotlight's ring on its slide, and the tool's cursor shows (text, zoom-in, crosshair); each tool's tooltip says how it works. Text typed there shows on the stage at once.
Typing on the slide
With T, every click adds a new text box on top of the slide (the slide's own text is never retyped, so its styles stay). The box starts at the click and grows with its text, wrapping at the slide's edge; text in Arabic or Hebrew ends at the click and runs right to left. A click on text typed during the show puts the caret there (Shift+click selects).
Typing goes through a hidden text field at the caret, so the system's editing applies: IME and Arabic input, paste (plain text), left/right in the text's direction, Shift to select, Ctrl/Cmd+A, Delete. Up/down and Home/End follow the lines as the slide lays them out. Ctrl/Cmd+Z undoes in the box (a run of typing at once, a paste on its own), Ctrl+Shift+Z or Ctrl+Y redoes; undo is recorded and sent like any typing. The caret blinks where the next letter goes, the selection is highlighted, and an outline follows the text as it grows. Esc, or a click elsewhere, finishes the box; a box left empty goes away. Keys typed into a box never drive the show.
Audience windows and followers (see Presenting) get the recording's look too: ink as it is drawn, the zoom, the spotlight, and text typed live (live with the deck for a window joining later).
Presenter-only UI never appears on the recorded stage: the hover controls, the rehearsal banner and the sound prompt are left out, and the controls live in the presenter view. Speaker notes there are optional (SlidesApp features={{ notes: false }}, or a host without notes).
Layout: recordingPlugin({ stage: { aspect: 4 / 3, safe: 0.05, webcamSize: 0.2 } }).
Media and video capture
The track carries no audio or video: record yours alongside, following onState ('recording', 'paused', 'recording' again, 'stopped'), so your media and the track share t = 0 and the same pauses.
For a video file instead of (or besides) a re-render, onStream hands over a MediaStream of the composited stage (slide, ink, cursor, spotlight, zoom, webcam): add your microphone track and record it with MediaRecorder; nothing is captured from the screen.
recordingPlugin({
onStream: (stream) => {
const mixed = new MediaStream([...stream.getVideoTracks(), ...micStream.getAudioTracks()]);
videoRecorder = new MediaRecorder(mixed);
},
onState: (s) => (s === 'recording' ? videoRecorder.start() : s === 'stopped' ? videoRecorder.stop() : undefined),
onTrack: saveTrack,
});Replaying
import { ShowReplay } from '@nextgensoftwares/folio-plugin-slides-motion/replay';
<audio ref={setAudio} src={audioUrl} controls />
<ShowReplay presentation={deck} layout={{ measurer }} track={track} media={audio} images={images} resolveSrc={resolve} />ShowReplay follows media.currentTime (play, pause and seek the media as usual; without media pass time={() => ms}). Builds and transitions replay from the recorded show state, ink and live text appear stroke by stroke, the cursor glides between its samples, transition and effect sounds play. The /replay entry has no editor code (a reader or viewer bundle). TrackPlayer is the DOM-free part: at(t) gives the state at any time, for a host's own renderer.
In a host with recorded lectures
A host that already records lectures as timelines next to an audio file, and replays them clocked by the <audio> element, plugs a slide lecture in as follows:
- Recording: the lecture recorder's
start/pause/stopare theonStatehandlers (its MediaRecorder starts with the track, so both share t = 0).onTrack(track)uploadstrack.eventsandtrack.durationMsto the existing finalize-timeline endpoint (events are opaque objects with a numerict, chunked into windows server-side), and the audio as before. Keep the deck's id and version with the lecture: the replay needs the same deck. - Live:
onEventstreams each event to the existing broadcast (batch them as the presenter hook does; it is called for every event, the pointer up to ~30 times a second while it moves, so don't set React state per event: that re-renders the show each time); a late joiner folds the log withTrackPlayerexactly like a replay at the live head. - Replay: the student's reader loads the timeline windows as now, concatenates them into a
ShowTrack(format,version,durationMs,sizefrom the lecture), and rendersShowReplaywith the lecture's<audio>asmedia, in place of the page stage. Existing chapter lectures are untouched (they don't haveshowevents). - Storage: about 50 bytes per event as JSON. Pointer samples (one per 33 ms while the pointer moves) are the bulk: up to about 90 KB per minute of continuous pointing before compression, a few times less gzipped, and still below the audio (Opus at 32 kbps is about 240 KB a minute).