MediaPreview class

Server-safe live media preview for a MediaStreamResult.

In browser builds this component attaches result.stream to the rendered media element's srcObject. On the server it renders the same HTML shape without touching browser APIs, so SSR and SEO remain safe.

Inheritance

Constructors

MediaPreview({required MediaStreamResult result, MediaPreviewType type = MediaPreviewType.video, String? id, bool controls = true, bool autoplay = true, bool muted = true, bool loop = false, bool playsInline = true, String? poster, MediaElementController? controller, Object? fallback, String? className, Map<String, Object?> props = const {}, Map<String, Object?> style = const {}, DartStyle? dartStyle})
Creates a live media preview for camera, microphone, or screen streams.

Properties

autoplay bool
Whether playback should start automatically when the stream is attached.
final
className String?
Optional CSS class.
final
controller MediaElementController?
Optional controller for imperative playback controls.
final
controls bool
Whether native browser playback controls are shown.
final
dartStyle DartStyle?
Typed Flint style.
final
elementId String
DOM id used by the rendered media element.
no setter
fallback Object?
Fallback content rendered inside the media element.
final
hashCode int
The hash code for this object.
no setterinherited
id String?
Optional DOM id. A generated id is used when omitted.
final
loop bool
Whether playback should loop.
final
muted bool
Whether the preview starts muted.
final
playsInline bool
Whether video should play inline on mobile browsers.
final
poster String?
Poster image for video previews before playback starts.
final
preserveState bool
Whether Flint should preserve this component instance across parent rerenders when the runtime type and tree position match.
no setterinherited
props Map<String, Object?>
Additional element props.
final
result MediaStreamResult
Capture result returned by MediaDevicesController.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style Map<String, Object?>
Additional inline styles.
final
type MediaPreviewType
Whether to render a video or audio media element.
final

Methods

attach(void scheduleRender()) → void
Attaches the render scheduler used by setState.
inherited
build() Object?
Builds this component's renderable output.
override
didMount() → void
Called after the component is first mounted in the browser.
inherited
didUpdate() → void
Called after the component updates following a rerender.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setState(FlintStateUpdater update) → void
Applies update and schedules this component to render again.
inherited
toString() String
A string representation of this object.
inherited
updateFrom(covariant FlintComponent next) → void
Receives the next component instance when Flint preserves this instance.
inherited
willUnmount() → void
Called before the component is removed from the tree.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited