Skip to main content

Crate day_piece_media

Crate day_piece_media 

Source
Expand description

day-piece-media — an EXTERNAL Day Piece (DESIGN.md §15) wrapping each toolkit’s NATIVE media player: AVPlayerView on AppKit, AVPlayerViewController on UIKit, QMediaPlayer + QVideoWidget on Qt, android.widget.VideoView on Android, GtkVideo on GTK. One Rust API registered link-time into each backend’s renderer slice without touching day. Like the webview it carries both a front-end AND its own native backends — including an Android manifest permission contribution (INTERNET) and an iOS framework contribution (AVKit + AVFoundation), see docs/extending.md.

The player is a growing leaf that fills its space (constrain it with .frame(w, h)). The url source accepts a plain string, a Signal<String>, or a closure, and may name a local file path OR an http(s)/file URL — every backend’s loader takes both. Configure playback at build with .autoplay(bool) / .looping(bool) / .muted(bool) / .controls(bool); transport is imperative and modeled with Copy Triggers — .play() / .pause() drive playback and .load() re-reads the bound url (then plays) — each watched to a MediaPatch.

Native chrome (.controls(true), the default) is free where the toolkit has it: AVPlayerView’s inline controls, AVPlayerViewController’s playback controls, Android’s MediaController. Qt’s QVideoWidget has no built-in chrome (drive it with triggers), and GtkVideo’s overlay controls are always on. See docs/media.md for the per-backend caveats.

Structs§

Media
A native media player bound to url. Attach command triggers with .play()/.pause()/.load(); fire them (Trigger::notify) from buttons.
MediaProps
Full props (realize). The initial url loads when the native view is created; the flags are fixed at build time.

Enums§

MediaPatch
Sparse imperative commands sent to the native player after creation.

Constants§

KIND

Functions§

media
media(url) — a native audio/video player for url (a string, Signal<String>, or closure; a file path or an http(s) URL). The initial value loads on creation and autoplays by default; call .load(trigger) and fire the trigger to (re)load whatever url currently holds.
Day API ↩ Guides· daybrite.dev