Expand description
App-facing integration traits and helpers for ultra-streamer-rs.
This crate defines the public contract that an adopting wgpu application can
implement without depending on the demo binary’s internal glue. The intent is
to keep integration explicit but small:
- expose the current render target via
StreamFrameProvider - consume browser input via
MappedInputApporRawInputApp - optionally observe session lifecycle events via
SessionLifecycle - reuse
LocalStreamEndpointsfor the built-in local browser/bootstrap wiring
A minimal integration typically looks like this:
ⓘ
use std::time::Duration;
use ustreamer_app::{AppActionSink, MappedInputApp, StreamFrameProvider, StreamFrameSource};
use ustreamer_input::{AppAction, InputMapper};
use ustreamer_proto::input::InputEvent;
struct MyRenderer {
instance: wgpu::Instance,
device: wgpu::Device,
queue: wgpu::Queue,
texture: wgpu::Texture,
}
impl StreamFrameProvider for MyRenderer {
fn stream_frame_source(&self) -> StreamFrameSource<'_> {
StreamFrameSource {
instance: &self.instance,
device: &self.device,
queue: &self.queue,
texture: &self.texture,
}
}
}
struct MyScene {
mapper: InputMapper,
}
impl AppActionSink for MyScene {
fn apply_app_action(&mut self, action: AppAction) -> Option<String> {
match action {
AppAction::PointerUpdate { .. } => None,
_ => Some(format!("handled {action:?}")),
}
}
}
impl MappedInputApp for MyScene {
fn input_mapper(&mut self) -> &mut InputMapper {
&mut self.mapper
}
fn handle_input_event(&mut self, event: &InputEvent) -> Option<String> {
let _ = event;
None
}
}Structs§
- Local
Stream Endpoints - Loopback endpoints for the built-in demo/browser bootstrap flow.
- Stream
Frame Source - Borrowed
wgpuobjects required by capture backends.
Constants§
- DEFAULT_
HTTP_ PORT - Default local HTTP bootstrap port used by the bundled browser client.
- DEFAULT_
STREAM_ PORT - Default local WebSocket streaming port used by the bundled browser client.
Traits§
- AppAction
Sink - Sink for default
ustreamer-inputAppActionvalues. - Mapped
Input App - App that wants raw input pre-processing plus the default mapped action bridge.
- RawInput
App - App that wants to consume raw browser input directly.
- Session
Lifecycle - Optional lifecycle hooks for integrations that want explicit connection events.
- Stream
Frame Provider - Trait for apps/renderers that can expose their current
wgpurender target.
Functions§
- drain_
mapped_ input_ events - Drain raw browser input, feed the adaptive quality controller, and apply the
default
InputMappertranslation for an app that usesMappedInputApp. - drain_
raw_ input_ events - Drain raw browser input for an app that wants to handle
InputEvents directly.