Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

recording

The editor's recording service. The F9 command, the Recording panel, the top bar's record button and the recording toolbox all call it.

A take is an av.record take filed under /zero/source/local/recordings/: this machine's own content, streamed to disk as it records, kept across restarts and outside the world's sync. The service keeps no state; what is recording, where, and how far along it is reads off av.status(), so any caller reports the same take.

Exports

  • M.start(opts?) -> (path?, reason?) — opts = { scope?, camera?, fps?, audio?, width?, height? }. scope is "viewport" (the scene view as it shows, no panels; the default) or "window" (the whole editor window). Yields: run it where it can.
  • M.stop() -> (Take?, reason?) — Take = { path, bytes, seconds }. Waits for the engine to file the take.
  • M.toggle(opts?) -> boolean — true when it started a take.
  • M.status() -> Status — { recording, path, seconds, bytes, scope, error }.
  • M.list() -> { Entry } — { path, bytes, modified? }, newest first.
  • M.delete(path) -> boolean — a take by file name or path; the take in flight is refused.
  • M.save(path) -> (boolean, string?) — userfile.save of the take.
  • M.declareCommand() — declares recording.toggle on F9.

Usage

local Recording = require("modules.api.editor.recording")
task.spawn(function()
    local path = Recording.start({ scope = "window" })
    task.wait(5)
    local take = Recording.stop()
    print(take and take.path, take and take.bytes)
end)