Skip to content

witySceneRender — Render Gateway ​

witySceneRender is the single public entry point for all wity-scene rendering. Send a scene XML document and an optional output format — the gateway parses the scene, selects the correct internal pipeline, and returns the rendered output URL. Callers never invoke the downstream Lambdas directly.

Location: services/scene-render/gateway/


Input ​

json
{
  "sceneXml":      "<wity-scene>...</wity-scene>",
  "outputFormat":  "mp4",
  "options": {}
}
FieldTypeDefaultDescription
sceneXmlstringrequiredThe <wity-scene> XML document
outputFormatstring"mp4"Output format: "mp4", "pdf", "pptx"

"mp4" options:

OptionTypeDefaultDescription
options.fpsnumber30Output frame rate
options.sceneWidthnumber1280Canvas width px
options.sceneHeightnumber720Canvas height px
options.fontManifestobject{}Custom fonts: { "FontName": "https://url/font.ttf" }

"pdf" options:

OptionTypeDefaultDescription
options.tsnumber0Scene time (seconds) to snapshot
options.timestampsnumber[]—One page per timestamp; overrides ts
options.variant"standard" | "print""standard"Screen (96 DPI) or print-ready (300 DPI)
options.dpinumber96 / 300Override render DPI
options.fontManifestobject{}Custom fonts

"pptx" options:

OptionTypeDefaultDescription
options.tsnumber0Scene time (seconds) to snapshot
options.timestampsnumber[]—One slide per timestamp; overrides ts
options.fontManifestobject{}Custom fonts

Output ​

json
{ "url": "https://...", "fileSize": 9876543, "pipeline": ["witySceneToVideo", "witySceneCompose"] }
FieldTypeDescription
urlstringPublic S3 URL of the rendered output
fileSizenumberOutput file size in bytes
pipelinestring[]Which internal Lambdas were invoked (observability / cost attribution)
pagesnumberNumber of pages — "pdf" only
slidesnumberNumber of slides — "pptx" only

Routing ​

"mp4" — content-aware routing ​

The gateway parses the scene and inspects element tags across all layers:

Scene contentRoutepipeline value
Only ws-rect / ws-text / ws-imagewitySceneToVideo only["witySceneToVideo"]
Graphics + ws-video / ws-audiowitySceneToVideo → witySceneCompose["witySceneToVideo", "witySceneCompose"]
Only ws-video / ws-audiowitySceneCompose only (graphicsMp4Url: null)["witySceneCompose"]
caller → witySceneRender
              │ parse + detect content
              ├─ hasGraphics? → witySceneToVideo → graphicsMp4Url
              └─ hasMedia?    → witySceneCompose(graphicsMp4Url) → final URL → caller

"pdf" and "pptx" — single downstream call ​

No content inspection. ws-video and ws-audio are silently skipped by the snapshot renderer.

caller → witySceneRender
              ├─ "pdf"  → witySceneToPdf  → S3 URL → caller
              └─ "pptx" → witySceneToPptx → S3 URL → caller

Lambda config ​

SettingValue
Function namewitySceneRender
RuntimeNode.js 20
Memory512 MB
Timeout660 s (11 min — accommodates two sequential 300 s downstream calls for mp4)
Ephemeral storage512 MB
FFmpeg layerNot required — this Lambda only parses and routes

Environment variables ​

VariableDefaultDescription
SCENE_TO_VIDEO_FUNCTIONwitySceneToVideoGraphics compiler Lambda
SCENE_COMPOSE_FUNCTIONwitySceneComposeFull compositor Lambda
SCENE_TO_PDF_FUNCTIONwitySceneToPdfPDF renderer Lambda
SCENE_TO_PPTX_FUNCTIONwitySceneToPptxPPTX renderer Lambda
AWS_REGIONap-south-1AWS region for Lambda invocations

IAM note: The execution role must have lambda:InvokeFunction on all four downstream Lambdas.


Error responses ​

StatusCondition
400sceneXml missing
400Invalid JSON body
400Malformed XML (parse error)
400Unknown outputFormat
400Scene has no renderable elements (mp4 only)
500Downstream Lambda failed

Downstream Lambdas (internal — do not invoke directly) ​

witySceneToVideo — graphics compiler ​

Renders ws-rect, ws-text, ws-image → PNG frame sequence → silent MP4. ws-video and ws-audio are silently ignored.

Package: @wity/scene-to-video

SettingValue
Memory3008 MB · Timeout 300 s · Ephemeral 4096 MB
FFmpeg layerarn:aws:lambda:ap-south-1:175033217214:layer:ffmpeg:1

witySceneCompose — full compositor ​

Blends ws-video clips + ws-audio tracks + optional graphics overlay via FFmpeg filter_complex.

Package: @wity/scene-compose

SettingValue
Memory2048 MB · Timeout 300 s · Ephemeral 4096 MB
FFmpeg layerarn:aws:lambda:ap-south-1:175033217214:layer:ffmpeg:1

witySceneToPdf — PDF renderer ​

Snapshots scene at one or more timestamps via node-canvas → pdf-lib → PDF file.

Package: @wity/scene-to-pdf

SettingValue
Memory2048 MB · Timeout 120 s · Ephemeral 1024 MB
FFmpeg layerNot required

witySceneToPptx — PPTX renderer ​

Snapshots scene at one or more timestamps via node-canvas → pptxgenjs → PowerPoint file.

Package: @wity/scene-to-pptx

SettingValue
Memory1024 MB · Timeout 120 s · Ephemeral 1024 MB
FFmpeg layerNot required

S3 output ​

The gateway does not write to S3. Downstream Lambdas write to the wity-user-generated-content bucket:

LambdaPrefix
witySceneToVideoscene-compiled/
witySceneComposescene-composed/
witySceneToPdfscene-pdf/
witySceneToPptxscene-pptx/

Extensibility ​

The gateway uses a PIPELINE_REGISTRY keyed by outputFormat. Adding a new format:

  1. Deploy a new specialized Lambda.
  2. Add one entry to PIPELINE_REGISTRY in handler.js.
  3. Add the corresponding env var to the gateway config.

No changes to any existing Lambda.