Media Stream
Updated
Plays a live stream through this entity’s sound or video, in place of its file.
- Type
comp-media-stream- Script class
MediaStreamComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Video and streams: what it does, how to use it from a script, and examples.
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
MediaStream::connectedMediaStream::disconnected
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Show your camera on a screenA script draws a clock on a canvas and writes it into a stream that one screen plays; clicking the button publishes your camera to the mirror screen.
Watch the clock screen tick. Click the amber button and allow the camera to see yourself on the mirror. Drag elsewhere to orbit the camera.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(MediaStreamComponent); if (component) log(component.props);}