Skip to main content

Module media

Module media 

Source
Expand description

Sound, moving pictures, and geometry — none of it decoded here.

The three surfaces in this module are the ones a general-purpose desktop application needs and cannot assemble out of a button and a slider: a player for audio, a player for video, and a viewer for a 3D model. They keep the posture the rest of the library keeps, which for media means something specific.

There is no player in this crate, and there is none in GPUI at the pinned revision. GPUI draws images and, on macOS, composites a CVPixelBuffer through its surface element; it has no decoder, no audio device, and no frame pump. So AudioPlayer and VideoPlayer are written against MediaTransport, the seam an operating-system backend lands behind, and a surface with no transport says exactly that instead of drawing a transport bar that would move if anything were playing.

A progress bar is never drawn from a guess. Position, duration, and buffered spans are the transport’s facts. A transport that reports no duration gets a position and no fraction, and a surface with no transport gets no track at all.

A fixture says so. FixtureTransport decodes nothing and advances no clock. Every surface publishes and draws MediaOrigin, so a scene, a test, and a screenshot all distinguish a fixture from a player.

A model is read inside a fence. ModelViewer takes a glTF 2.0 document through the bounded reader in gltf, which accepts a stated subset, refuses anything outside it, and refuses anything past ModelBounds before allocating for it. The refusal is the contract; the shading is deliberately minimal.

Re-exports§

pub use audio_player::AudioPlayer;
pub use gltf::ModelBounds;
pub use gltf::ModelDefect;
pub use gltf::ModelError;
pub use gltf::ModelLimit;
pub use gltf::ModelMesh;
pub use gltf::ModelScene;
pub use model_viewer::ModelShading;
pub use model_viewer::ModelState;
pub use model_viewer::ModelViewer;
pub use model_viewer::ModelViewerEvent;
pub use transport::FixtureTransport;
pub use transport::MediaAvailability;
pub use transport::MediaCommand;
pub use transport::MediaEvent;
pub use transport::MediaOrigin;
pub use transport::MediaOutcome;
pub use transport::MediaSnapshot;
pub use transport::MediaTransport;
pub use video_player::VideoPlayer;

Modules§

audio_player
A player for one piece of audio, over a transport this crate does not own.
gltf
A bounded reader for a stated subset of glTF 2.0.
model_viewer
A bounded viewer for a 3D model: orbit, flat shading, and a refusal.
transport
The seam between a player and the surfaces that show one.
video_player
A player for one piece of video: a frame surface, and the same transport.