pub struct StreamHandle { /* private fields */ }Expand description
A handle to a running RTMP streaming session.
This handle manages the lifecycle of both the RTMP server and the FFmpeg streaming context. When dropped, it will attempt to clean up resources.
§Example
let handle = EmbedRtmpServer::stream_builder()
.address("localhost:1935")
.app_name("live")
.stream_key("stream1")
.input_file("video.mp4")
.start()?;
// Wait for streaming to complete
handle.wait()?;Implementations§
Source§impl StreamHandle
impl StreamHandle
Sourcepub fn wait(self) -> Result<(), StreamError>
pub fn wait(self) -> Result<(), StreamError>
Waits for the streaming session to complete.
This method blocks until the FFmpeg context finishes processing (e.g., when the input file ends or an error occurs).
§Returns
Returns Ok(()) if streaming completed successfully, or an error
if something went wrong during streaming.
Sourcepub fn local_addr(&self) -> Option<SocketAddr>
pub fn local_addr(&self) -> Option<SocketAddr>
The actual bound socket address of the underlying RTMP server.
Useful when the builder was given "127.0.0.1:0": the OS assigns a real
port, and this surfaces it (delegating to
EmbedRtmpServer::local_addr) so tests and callers can observe the
port without a bind/drop/rebind race on a pre-probed one.