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
-
- Object
- FlintNode
- FlintComponent
- StatefulComponent
- MediaPreview
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
- isBrowser → bool
-
Whether this component is currently running in a browser JS runtime.
no setterinherited
- isInitialized → bool
-
Whether ensureInitialized (initProps and initState) has run on this
component instance.
no setterinherited
- isServer → bool
-
Whether this component is currently running on the server (SSR / VM).
no setterinherited
- 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.
covariantfinalgetter/setter pairinherited-setteroverride-getter
- 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 DOM.
inherited
-
didUpdate(
) → void -
Called after the component updates following a rerender.
inherited
-
ensureInitialized(
) → void -
Ensures initProps and initState have executed once before build.
inherited
-
initProps(
) → void -
Universal synchronous hook called before initState and build on BOTH
the server (SSR) and the browser client.
inherited
-
initState(
) → void -
Universal synchronous lifecycle hook called once before the first build
on BOTH the server (SSR) and the browser client.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setState(
FlintStateUpdater update, {bool render = true}) → void -
Applies
updateand schedules this component to render again.inherited -
shouldUpdate(
covariant FlintComponent next) → bool -
Whether this component should rerender when it is updated from a new
instance in the parent tree.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateFrom(
covariant StatefulComponent 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