> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stmlink.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> 对外开放的服务端接口有两组前缀，都用同一套鉴权：`/server/v1/...`（SRTC 与 SMeeting 的主接口）和 `/stm/srvapi/v1/...`（SMeeting 的用户体系，服务端极简对接会用到）。鉴权是 app_id + nonce + timestamp + signature 四个请求头，用 app_key 做 HMAC-SHA256 签名，只能从业务方自己的后端调用。除这两组前缀外的接口均为内部接口，不要建议客户调用。 Public server APIs use two path prefixes with the same authentication: `/server/v1/...` (the main APIs of both SRTC and SMeeting) and `/stm/srvapi/v1/...` (the SMeeting user system, used by server-side low-code integration). Authenticate with four request headers, app_id + nonce + timestamp + signature, where signature is HMAC-SHA256 keyed with app_key; call these APIs only from the customer's own backend. Any other path is internal: never suggest calling it.
> app_key 是服务端密钥，绝不能出现在客户端代码、前端配置或移动 App 里。客户端加入频道用的 token 必须由业务方后端签发后下发（SRTC 走 `/server/v1/channel/grant`，SMeeting 走 `/stm/srvapi/v1/member/grant`）。 app_key is a server-side secret and must never appear in client code, frontend config, or a mobile app. The token a client uses to join must be issued by the customer's backend and passed down to the client (SRTC: `/server/v1/channel/grant`; SMeeting: `/stm/srvapi/v1/member/grant`).
> SRTC 与 SMeeting 是上下两层不同的产品，术语不通用：SRTC 是音视频底座，说「频道 channel」「加入 / 退出」；SMeeting 建在 SRTC 之上，说「房间 room」「会议 meeting」「进入 / 退出」。回答时按用户所在的层用对应术语，不要把「房间」「会议」安到 SRTC 的接口上，也不要用「频道」「加入 / 离开」描述 SMeeting 的概念（接口标识符原样保留）。 SRTC and SMeeting are two separate layers with different terminology. SRTC is the audio/video foundation: it has channels, and users join and leave a channel. SMeeting is built on top of SRTC: it has rooms and meetings, and members enter and exit a meeting. Answer in the terms of the layer the user is working with: never apply "room" or "meeting" to SRTC APIs, and never describe SMeeting concepts in prose with "channel", "join", or "leave" (API identifiers such as `force_join` keep their literal names).
> 同一能力在各端 SDK 里的包名、类名、方法名并不相同。写示例代码时请使用文档中该端自己的 API，不要把一个端的写法套到另一个端上。苹果平台每个产品都有两套 SDK（Swift 原生与 Objective-C），两套 API 不能混用。 Package, class, and method names differ between platform SDKs for the same capability. In sample code, use the API documented for that platform; never carry one platform's code over to another. On Apple platforms each product ships two SDKs (native Swift and Objective-C) whose APIs must not be mixed.

# Media output guide

> Send a meeting's video and audio out: HTTP-FLV / RTSP pull URLs and RTMP / RTMPS push tasks. Video from the composite video or any one user, audio from the meeting's mixed audio or any one user, in any combination; covers the stream mixing dependency, protocol limits, push status and alarms, and migrating from the old endpoints

This page covers how media output works at the meeting layer. For the parameters and response structure of each endpoint, see [Media output](https://docs.stmlink.com/en/meeting/server-api/stream.md).

> [!NOTE]
>
> Media output at the meeting layer passes through to the SRTC endpoints of the same name, so the capabilities, protocol limits, and error codes are exactly the same as SRTC's; for details, see the SRTC [Media output guide](https://docs.stmlink.com/en/rtc/server-api/guides/media-output.md). This page covers only the meeting-layer differences and common usage.

## One set of sources, two kinds of output

| Output | Endpoint | Protocol | Suited to |
| - | - | - | - |
| Pull | [Request a pull URL](https://docs.stmlink.com/en/meeting/server-api/stream.md) | HTTP-FLV, RTSP | Web players, business systems, and NVRs / surveillance platforms that pull the stream themselves |
| Push | [Start a push](https://docs.stmlink.com/en/meeting/server-api/stream.md#start-a-push) | RTMP, RTMPS | Pushing to WeChat Channels, Douyin, your own CDN, or other live streaming platforms |

Video and audio each choose their own source, for both pulling and pushing:

| Parameter | Values | Description |
| - | - | - |
| `video` | `mcu` / `user` / `none`, required | `mcu` is the meeting's composite video; `user` is one user's video (with `video_uid`, the in-meeting user ID); `none` means no video |
| `video_desc` | Track description | When the user publishes multiple video tracks at once (such as camera and screen sharing), specifies one of them; if omitted, the first one to arrive is used |
| `audio` | `auto` (default) / `mix` / `user` / `none` | `auto` follows the video: the composite video comes with the meeting's mixed audio, a single user's video with that user's own audio, and it can't be used without video; `mix` is the meeting's mixed audio; `user` is one user's audio (with `audio_uid`) |
| `audio_desc` | Track description | When the user publishes multiple audio tracks, specifies one of them; if omitted, the first one is used |

`video` and `audio` can't both be `none`. Video and audio can come from different users; for example, "presenter's video + the meeting's mixed audio" is `video=user`, `video_uid=presenter`, `audio=mix`.

## Differences from SRTC

* Use `meeting_id` to specify the meeting instead of SRTC's `channel`
* `video_uid` / `audio_uid` take the in-meeting user ID
* **Stopping a push requires both `meeting_id` and `push_id`**; `1074` is returned if the push doesn't belong to this meeting
* Starting a push requires the meeting to be in progress (someone is in the meeting); when the meeting ends and everyone leaves, all of its pushes stop automatically
* Requesting a pull URL or starting a push returns `2101` if the meeting for `meeting_id` doesn't exist

## The composite video and mixed audio depend on a stream mixing task

When the composite video (`video=mcu`) or the meeting's mixed audio is used, the meeting must have a **stream mixing task in progress** (`task_type` includes `2`):

* **Composite-mode meetings** start a stream mixing task automatically on the server once people enter, so you can use it directly
* **Regular meetings** need you to [start a recording task](https://docs.stmlink.com/en/meeting/server-api/mcu.md) first with `task_type` including `2` (for example, `2` for stream mixing only, `3` for video recording + stream mixing). The layout is configured there; see the [Cloud recording and stream mixing guide](https://docs.stmlink.com/en/meeting/server-api/guides/recording.md)

Without a stream mixing task, pulling returns `1073` right away; a push can be created in advance, stays in `waiting`, and starts automatically once the stream mixing task starts.
Using only a single user's video and audio doesn't depend on a stream mixing task.

## Key points of pulling and pushing

* **HTTP-FLV** video is H264 only, without transcoding (no video can be pulled if the publisher uses VP8; the composite video is always H264); audio is transcoded to AAC
* **RTSP** video is passed through as is (H264 / H265 / VP8); audio is transcoded to AAC by default, and `rtsp_audio=opus` passes it through as is; RTSP over TCP only
* Pull URLs are signed and valid for 24 hours by default; sources are subscribed only when someone pulls, nothing is consumed when no one is pulling, and there is nothing to stop
* **Pushes**: a meeting can push multiple streams at once; starting again for the same push URL in the same meeting returns the existing `push_id` (updated to the new sources if they changed)
* Push status is `waiting` / `connecting` / `publishing` / `retrying` / `stopped`; check it with [List push tasks](https://docs.stmlink.com/en/meeting/server-api/stream.md#list-push-tasks)
* Audio only (`video=none`) has limits: HTTP-FLV doesn't fill in silence when the audio drops out, and many live streaming platforms don't accept audio-only pushes

## Push failure alarms

When a push keeps failing (retrying for about 90 seconds), you are notified through the [`mcu_alarm` callback](https://docs.stmlink.com/en/meeting/server-api/guides/callbacks):
**`task_type` `0` means it's a push alarm, and `task_id` is then the `push_id`**—not a recording task, so don't pass it to `mcu/*` endpoints.
An alarm doesn't mean the push has stopped; rely on `status` in the push list.

## Migrating from the old usage

The old live streaming endpoints and usage have been removed with no compatibility period; switch your callers to the new endpoints:

| Old usage | New usage |
| - | - |
| `layout_data.push_url` / `push_audio*` of `mcu/start` | Removed. Use `stream/push/start` with `video=mcu`, and `audio` equivalent to the old `push_audio`; stop with `stream/push/stop` |
| `task_type` including `8` (live stream) | Type `8` has been removed; use `2` (stream mixing) plus the media output endpoints above. Passing `8` or a combination that includes `8` (such as `9`) to `mcu/start` or `mcu/stop` returns parameter error `10070` (invalid request parameters); at upgrade time, the `task_type` of historical tasks has `8` replaced with `2` (for example, `9` → `3`) |
| `mcu/live-url` | Removed. Use `stream/pull-url` (`protocol=flv`, `video=mcu`), which returns `url` and `expire_at`; when no stream mixing task is in progress, error code `1073` is returned (previously success with `data` null) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.