Media Recorder Events
Description
This Media Recorder allows you to capute screenshots and record video of your Studio project at runtime.
Events
RECORDER_SCREENSHOT_READY
Emitted when screenshot is ready.
Properties
Property | Type | Description |
---|---|---|
blob | Blob | The JPEG image blob of the screenshot |
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_SCREENSHOT_READY, (e) => {
const blob = e.data;
console.log('Screenshot blob:', blob);
});
RECORDER_VIDEO_STARTED
Emitted when recording has started.
Properties
None.
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_VIDEO_STARTED, () => {
console.log('Recording started');
});
RECORDER_VIDEO_STOPPED
Emitted when recording has stopped.
Properties
None.
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_VIDEO_STOPPED, () => {
console.log('Recording stopped');
});
RECORDER_VIDEO_ERROR
Emitted when there is an error.
Properties
Property | Type | Description |
---|---|---|
message | string | The error message |
name | string | The error name |
stack | string | The error stack trace |
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_VIDEO_ERROR, (error) => {
console.error('Recorder error:', error.message);
});
RECORDER_VIDEO_READY
Emitted when recording has completed and video is ready.
Properties
Property | Type | Description |
---|---|---|
videoBlob | Blob | The recorded video blob |
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_VIDEO_READY, ({ videoBlob }) => {
console.log('Video ready:', videoBlob);
});
RECORDER_PREVIEW_READY
Emitted when a previewable, but not sharing-optimized, video is ready (Android/Desktop only).
Properties
Property | Type | Description |
---|---|---|
videoBlob | Blob | The preview video blob |
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_PREVIEW_READY, ({ videoBlob }) => {
console.log('Preview ready:', videoBlob);
});
RECORDER_FINALIZE_PROGRESS
Emitted when the media recorder is making progress in the final export (Android/Desktop only).
Properties
Property | Type | Description |
---|---|---|
progress | number | Finalization progress (0 to 1) |
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_FINALIZE_PROGRESS, ({ progress }) => {
console.log(`Finalize progress: ${progress * 100}%`);
});
RECORDER_PROCESS_FRAME
Properties
Property | Type | Description |
---|---|---|
frame | ImageData | The processed video frame |
timestamp | number | The timestamp of the frame (ms) |
Example
world.events.addListener(world.events.globalId, ecs.events.RECORDER_PROCESS_FRAME, ({ frame, timestamp }) => {
console.log(`Processed frame at ${timestamp}ms`, frame);
});