Manage streams
List, retrieve, stop, and re-egress existing video streams.
Use the Lattice SDK to inspect active streams, retrieve a specific stream, archive a stream when its source goes offline, and re-publish over RTSP or SRT for downstream consumers.
Before you begin
- To inspect and manage streams, set up your Lattice environment.
- See an overview of the Video Manager API and stream lifecycle in Lattice.
- If you haven’t already, learn how to stream a video.
These gRPC examples authenticate with a static environment token attached as request metadata. If you are using OAuth 2.0 client credentials instead, set up the token refresh module before running the examples on this page.
Stream ownership
Your integration owns the lifecycle of the IngressStream records it creates. Streams are not automatically removed when a publisher disconnects, a stream becomes inactive, or your integration stops communicating with Lattice. A stream with status STREAM_STATUS_INACTIVE still exists; when the source or publisher reconnects, reuse the existing stream rather than creating another one.
Persist each stream’s ingress_id with the asset or integration that owns it. On startup or reconnect, call GetIngressStream with the saved ID to check the stream. If you don’t have the ID, use ListIngressStreams and inspect its pages to find the stream. Create a new stream only after checking that an existing one for the source does not already exist.
List active streams
Call ListIngressStreams to retrieve the current page of active streams. Archived streams are not returned. Send an empty request to fetch the first page (default: 50, max: 100), then iterate while next_page_token is non-empty.
Pass the previous response’s next_page_token as page_token and keep every other request field identical. The server may reject requests that change other fields between pages.
Get a single stream
Call GetIngressStream with an ingress_id to retrieve a single IngressStream. The response includes the current status, ingress configuration, and associated egress stream identifiers. For a description of every field, see IngressStream object.
MPEG-TS ingress is supported only at the edge, in closed networks. If you connect to Lattice over the public internet, you can’t start an MPEG-TS stream, but a stream created at the edge still appears in ListIngressStreams and can be inspected with GetIngressStream.
Stop an ingress stream
Stopping a stream archives it. The IngressStream record remains retrievable with GetIngressStream, but its status transitions to STREAM_STATUS_ARCHIVED and ListIngressStreams no longer returns the record.
DeleteIngressStream does not delete the underlying record. To remove the stale media reference from the camera entity, follow up with an OverrideEntity call as shown in the example below. The example reads the entity, filters out the stale MediaItem, and writes the surviving items back. A field_path of media replaces the entire Media component while leaving every other entity component untouched.
List active egress streams
Call ListEgressStreams to retrieve the current page of active egress streams. Each entry pairs an egress_id with the ingress_id it re-publishes, so you can see every downstream consumer of a source. Send an empty request to fetch the first page (default: 50, max: 100), then iterate while next_page_token is non-empty.
Pass the previous response’s next_page_token as page_token and keep every other request field identical. The server may reject requests that change other fields between pages.
Get a single egress stream
Call GetEgressStream with an egress_id to retrieve a single EgressStream. The response includes the ingress_id it re-publishes and the protocol-specific connection details, either an RtspEgress or an SrtEgress, that a downstream consumer uses to pull the stream.
Stop an egress stream
Call DeleteEgressStream with an egress_id to stop delivering a stream to its downstream consumers. Deleting an egress stream stops only that downstream delivery; the underlying ingress stream and any other egress streams consuming it are unaffected.
Deleting an IngressStream automatically stops every egress stream consuming it, so you don’t need to delete egress streams individually before stopping their source. DeleteEgressStream returns NOT_FOUND if no matching active egress stream exists.
What’s next
- Overview: Review the API surface and stream lifecycle.
- Create streams: Publish an asset and start an ingress stream.