nimeet Docs
中文

Media Gateway (RTMP Gateway / RTLS Ingress)

Stream keys, stream templates, online streams, mute/disconnect, appconfig and reconciliation.

Version v1.1.0 · Updated 2026-10-26 · revision 1

Media Gateway (called rtls/ingress in the interface definition, product name "RTMP gateway") addresses bringing external RTMP pushes into an RTC channel: a broadcaster pushes with OBS or a similar tool to the address we hand out, and viewers in the channel see it exactly like a normal participant.

Three concepts need to be kept apart:

ConceptRoleLifecycle
streamkeyPush credential bound to a target (which channel, which uid, when it expires)Single-use / short-lived; delete it when done
stream templateA template of push parameters (transcoding, jitter buffer)Long-lived, reusable
online streamOne stream currently being pushed (a session); it can be queried, muted and disconnectedCreated and ended with the push

Global configuration

bash
curl -s -X PUT "$NIMEET_API_BASE/cn-shanghai/v1/projects/$APP_ID/rtls/ingress/appconfig" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
  -H 'Content-Type: application/json' \
  -d '{"settings":{"defaultStreamTemplate":"standard-720p"}}'

settings.defaultStreamTemplate points at a template id; pushes that do not carry a template use it.

Creating a streamkey (broadcaster-side push credential)

bash
curl -s -X POST "$NIMEET_API_BASE/cn-shanghai/v1/projects/$APP_ID/rtls/ingress/streamkeys" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
  -H 'Content-Type: application/json' \
  -d '{"settings":{"channel":"weekly-sync","uid":"30001","expiresAfter":3600,"templateId":"standard-720p"}}'
FieldTypeDescription
channelstringTarget channel
uidstring \numberIdentity inside the channel (a string account name works)
expiresAfterintegerValidity in seconds
templateIdstringTemplate id to use

data.streamKey in the response is the stream key. OBS setup: put rtmp://<your-gateway-domain>/live in Server and the streamKey in Stream Key.

Stream templates

bash
# create / overwrite a template
curl -s -X PUT "$NIMEET_API_BASE/cn-shanghai/v1/projects/$APP_ID/rtls/ingress/stream-templates/standard-720p" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
  -H 'Content-Type: application/json' \
  -d '{"settings":{"transcoding":{"width":1280,"height":720,"frameRate":30,"bitrate":2000},"jitterBuffer":{"sizeMs":500}}}'

# partial update
curl -s -X PATCH "$NIMEET_API_BASE/cn-shanghai/v1/projects/$APP_ID/rtls/ingress/stream-templates/standard-720p" \
  -H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
  -H 'Content-Type: application/json' \
  -d '{"settings":{"jitterBuffer":{"sizeMs":300}}}'

transcoding controls the transcoding parameters and jitterBuffer controls the jitter buffer: lower sizeMs when chasing low latency for live (the trade-off is higher sensitivity to stutter).

Online stream management

OperationEndpointDescription
ListGET /{region}/v1/projects/{appId}/rtls/ingress/online-streams (optionally filtered by channel)Returns the sessions that are currently pushing
Query oneGET /{region}/v1/projects/{appId}/rtls/ingress/online-streams/{sid}Details and state of that stream
MutePOST /{region}/{version}/projects/{appId}/rtls/ingress/online-streams/mute/{sid}Server-side mute (does not kick the user)
DisconnectDELETE /{region}/v1/projects/{appId}/rtls/ingress/online-streams/{sid}Disconnects the push and ends the session

Typical integration sequence

  1. The server creates a streamkey (binding channel + uid + template) and hands the streamKey to the broadcaster;
  2. The broadcaster pushes from OBS, the gateway establishes a session, and that uid appears in the channel (other clients receive user-published);
  3. You can see the sid in online-streams and mute or DELETE it when needed;
  4. When the push ends the session disappears; once the streamkey expires or is explicitly DELETEd, it can no longer be used.

Difference from Media Push

Media Gateway (ingress)Media Push (egress)
DirectionExternal stream → channelChannel → RTMP address
Typical scenarioOBS pushing into a meeting or a live streamChannel content pushed to a CDN
Resourcesstreamkey / template / online-streamconverter

The two can be combined: OBS pushes into the channel (Gateway) → the mixed stream is then pushed to a CDN (Push).

Quotas and errors

ScenarioResponse
Service not enabled403 service_not_enabled
More than 10 stream templates429 streaming_quota_exceeded (at most 10 templates can exist under one app id)
Pushing after the streamkey expiredThe gateway rejects the handshake (that sid never appears in online-streams)
The same uid pushing twiceArbitrated by the media plane: the later connection replaces the earlier one and the old sid becomes invalid; the control plane only reflects real sessions
Invalid template dimension400 validation, with field-level errors in details

End-to-end example

bash
node run-all.mjs --only=20

20-media-gateway-lifecycle.mjs: appconfig → create template → create streamkey → query streamkey → query online streams → delete streamkey → delete template (writes, so it needs --all).

Generated by the documentation build pipeline · 2026-10-31 01:24:02 UTC · Documentation center v1.1.0.

Content follows the public API definitions.

ni-meet is a self-hosted RTC PaaS with a LiveKit-based media plane (Apache-2.0) and an Agora-compatible API.