Expand description
§autumn-media-plugin
Live-streaming media plugin for autumn-web applications. It packages the
two primitives an interactive streaming product needs:
- Broadcast — one creator ingests (RTMP / WHIP / browser WebRTC) and a
fan-out audience watches over low-latency WebRTC/WHEP with HLS fallback,
backed by
MediaMTX; recordings become VODs and clip/highlight encodes. - Room — a small (mesh, no SFU) multi-participant call capped at
config::DEFAULT_ROOM_MAX_PARTICIPANTSparticipants.
Both primitives are off by default. Enable each one on the builder:
| Builder call | Installs |
|---|---|
with_broadcast | MediaMtxClient and MediaUrls extensions |
with_rooms | Room routes, RoomService and the room reaper |
| Either one | MediaStorage, MediaWorkflows and the encode jobs |
The retention sweep also starts if you set
recordings_root. If the storage config is
not valid, the plugin installs no storage, workflows, jobs or sweep.
If you enable neither primitive, the plugin installs no routes, extensions or jobs. It logs a warning.
Because Autumn resolves config after Plugin::build runs, the plugin
cannot read [media] from inside build; the application loads a
MediaConfig up front and passes it in via
MediaPlugin::config (mirroring the autumn-storage-s3
from_config(&cfg) -> …with_blob_store(store) pattern).
use autumn_media_plugin::{prelude::*, MediaPlugin};
let media = MediaConfig::from_autumn_toml("autumn.toml")?;
autumn_web::app()
.plugin(MediaPlugin::new().config(media).with_broadcast())
.run()
.await;§Naming convention
First-party plugin: autumn-<name>-plugin.
Re-exports§
pub use config::MediaConfig;pub use config::MediaConfigError;pub use config::MediaMtxConfig;pub use config::MediaStorageBackend;pub use config::MediaStorageConfig;pub use config::RecordingConfig;pub use config::RoomStoreBackend;pub use encode::FfmpegClipTailCommand;pub use encode::FfmpegHighlightCommand;pub use encode::FfmpegLiveThumbnailCommand;pub use encode::FfmpegPosterCommand;pub use encode::FfmpegPreviewSpriteCommand;pub use encode::FfmpegRoomCompositeCommand;pub use encode::PREVIEW_CELL_HEIGHT;pub use encode::PREVIEW_CELL_WIDTH;pub use encode::PREVIEW_FRAME_INTERVAL_SECONDS;pub use encode::PREVIEW_SPRITE_COLUMNS;pub use encode::ROOM_COMPOSITE_CELL_HEIGHT;pub use encode::ROOM_COMPOSITE_CELL_WIDTH;pub use encode::build_preview_webvtt;pub use encode::newest_recording_file;pub use encode::newest_recording_files;pub use encode::newest_recording_files_since;pub use encode::recording_segments_covering_window;pub use encode::slugify;pub use error::MediaError;pub use retention::RetentionDefer;pub use retention::RetentionReport;pub use retention::is_expired;pub use retention::recording_expires_at;pub use retention::spawn_retention_sweep_loop;pub use retention::sweep_recordings_root;pub use retention::within_root;pub use rooms::HeartbeatRequest;pub use rooms::HeartbeatResponse;pub use rooms::InMemoryRoomStore;pub use rooms::JoinRecord;pub use rooms::JoinRequest;pub use rooms::JoinResponse;pub use rooms::LeaveRequest;pub use rooms::ParticipantView;pub use rooms::PublishTarget;pub use rooms::ReapFuture;pub use rooms::ReapStats;pub use rooms::RoomError;pub use rooms::RoomLeaveResponse;pub use rooms::RoomService;pub use rooms::RoomSnapshot;pub use rooms::RoomStore;pub use rooms::RoomStoreFuture;pub use rooms::SessionToken;pub use rooms::SubscribeTarget;pub use rooms::renewed_expiry;pub use rooms::room_participant_path;pub use rooms::room_route_infos;pub use rooms::room_router;pub use rooms::spawn_room_reaper_loop;pub use rooms::validate_room_segment;pub use rooms_db::DbRoomStore;pub use sink::MediaArtifact;pub use sink::MediaArtifactFile;pub use sink::MediaArtifactKind;pub use sink::MediaArtifactSink;pub use sink::MediaArtifactSinkExt;pub use sink::MediaSinkFuture;pub use storage::MediaStorage;pub use storage::S3MediaStorage;pub use storage::StoredObject;pub use transport::IngestStatus;pub use transport::MediaMtxClient;pub use transport::MediaUrls;pub use transport::StreamQualityStats;pub use transport::StreamStatus;pub use transport::ViewerCount;pub use transport::duration_seconds_param;pub use transport::ingest_statuses_from_paths_json;pub use transport::quality_stats_from_path_json;pub use transport::recording_available;pub use transport::recording_mediamtx_path;pub use transport::stream_status_from_path_json;pub use transport::viewer_count_from_path_json;pub use transport::viewer_counts_from_paths_json;pub use workflows::FinalizeRecordingJobArgs;pub use workflows::MediaWorkflowDelegate;pub use workflows::MediaWorkflowDelegateExt;pub use workflows::MediaWorkflowRequest;pub use workflows::MediaWorkflows;pub use workflows::PreviewJobArgs;pub use workflows::RoomCompositeJobArgs;pub use workflows::ThumbnailJobArgs;pub use workflows::TranscodeJobArgs;pub use workflows::media_job_infos;
Modules§
- config
- Configuration for
MediaPlugin. - encode
- Dependency-free
FFmpegencode primitives: command builders, concat-list plumbing, seek-previewWebVTT, and recording-segment discovery. - error
- Shared error type for the media plugin’s storage (and, in later slices, encode/transport) surfaces.
- prelude
- Common downstream imports for configuring and mounting the media plugin.
- retention
- Generic, harvest-free recording-retention sweep.
- rooms
- Small mesh (no-
SFU) multi-participant call rooms and theirMediaMTXWHIP/WHEPsignaling surface. - rooms_
db - A shared, database-backed
RoomStoreso mesh-room state survives across processes / instances (multi-process safety, epic #1974). - sink
MediaArtifactSink— the app-supplied completion callback the generic media workflows invoke once a derived artifact is encoded and persisted.- storage
MediaStorage— a completed-media object store with caller-supplied keys.- transport
MediaMTXtransport: control-API client plus ingest/playback URL builders.- workflows
- Generic, harvest-free media workflows built on autumn-web’s
#[job]system.
Structs§
- Media
Plugin - The live-streaming media plugin.