# 文档 ## 推流服务 ## 本地视频推流 Controller 本地视频直接推送到 Cloudflare WHIP: - POST /stream/local/start 启动本地视频推流 - POST /stream/local/stop 停止本地视频推流 - GET /stream/local/{name} 获取推流状态 - GET /stream/local/list 获取所有本地视频推流 ### 启动本地视频推流 维护人:TG Live #### URL - 本地开发环境: `POST` http://localhost:10050/api/stream/local/start - 开发环境: `POST` https://tg-live-game.pwtk.cc/api/stream/local/start 描述:启动本地视频推流 ContentType:`application/json` #### 请求参数 ##### Body Parameter | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --------------- | ------- | ---- | -------- | ------------------------------------------- | ------ | | streamName | String | 否 | - | 流名称(唯一标识) | | | videoPath | String | 否 | - | 视频文件路径 | | | loop | Boolean | 否 | - | 是否循环播放 | true | | targetChannelId | String | 否 | - | 目标推流通道 ID(可选,不传则使用默认通道) | | #### 请求示例 ``` { "streamName": "string", "videoPath": "string", "loop": true, "targetChannelId": "string" } ``` #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | -------------- | ------- | ---- | -------- | ------------------------------------------ | ------ | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | | 响应数据 (ActualType: LocalVideoStreamDTO) | | | └ streamName | String | 否 | - | 流名称 | | | └ sourceType | String | 否 | - | 源类型:local_video 或 rtsp_camera | | | └ sourcePath | String | 否 | - | 源路径(视频文件路径或 RTSP URL) | | | └ rtspUrl | String | 否 | - | MediaMTX 提供的 RTSP URL | | | └ loop | Boolean | 否 | - | 是否循环播放 | true | | └ streamTaskId | String | 否 | - | 推流任务 ID(如果已推送到 Cloudflare) | | | └ playbackUrl | String | 否 | - | 播放地址(Cloudflare HLS/WHEP) | | | └ status | String | 否 | - | 状态 | | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": { "streamName": "string", "sourceType": "string", "sourcePath": "string", "rtspUrl": "string", "loop": true, "streamTaskId": "string", "playbackUrl": "string", "status": "string" } } ``` #### 错误码 无 ### 停止本地视频推流 维护人:TG Live #### URL - 本地开发环境: `POST` http://localhost:10050/api/stream/local/stop - 开发环境: `POST` https://tg-live-game.pwtk.cc/api/stream/local/stop 描述:停止本地视频推流 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### 请求参数 ##### Query Parameter | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | ---------- | ------ | ---- | -------- | ------------------ | ------ | | streamName | string | 是 | - | No comments found. | | #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | ---------- | ------- | ---- | -------- | --------------------------- | ------ | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | - | 响应数据 (ActualType: Void) | | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": {} } ``` #### 错误码 无 ### 获取本地视频推流状态 维护人:TG Live #### URL - 本地开发环境: `GET` http://localhost:10050/api/stream/local/{streamName} - 开发环境: `GET` https://tg-live-game.pwtk.cc/api/stream/local/{streamName} 描述:获取本地视频推流状态 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### Path 参数 | 名称 | 必填 | 描述 | 示例值 | | ---------- | ---- | ------------------ | ------ | | streamName | 是 | No comments found. | | #### 请求参数 #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | -------------- | ------- | ---- | -------- | ------------------------------------------ | ------ | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | | 响应数据 (ActualType: LocalVideoStreamDTO) | | | └ streamName | String | 否 | - | 流名称 | | | └ sourceType | String | 否 | - | 源类型:local_video 或 rtsp_camera | | | └ sourcePath | String | 否 | - | 源路径(视频文件路径或 RTSP URL) | | | └ rtspUrl | String | 否 | - | MediaMTX 提供的 RTSP URL | | | └ loop | Boolean | 否 | - | 是否循环播放 | true | | └ streamTaskId | String | 否 | - | 推流任务 ID(如果已推送到 Cloudflare) | | | └ playbackUrl | String | 否 | - | 播放地址(Cloudflare HLS/WHEP) | | | └ status | String | 否 | - | 状态 | | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": { "streamName": "string", "sourceType": "string", "sourcePath": "string", "rtspUrl": "string", "loop": true, "streamTaskId": "string", "playbackUrl": "string", "status": "string" } } ``` #### 错误码 无 ### 获取所有本地视频推流 维护人:TG Live #### URL - 本地开发环境: `GET` http://localhost:10050/api/stream/local/list - 开发环境: `GET` https://tg-live-game.pwtk.cc/api/stream/local/list 描述:获取所有本地视频推流 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### 请求参数 #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | -------------- | ------- | ---- | -------- | -------------------------------------- | ------ | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | array | 否 | | 响应数据 (ActualType: List) | | | └ streamName | String | 否 | - | 流名称 | | | └ sourceType | String | 否 | - | 源类型:local_video 或 rtsp_camera | | | └ sourcePath | String | 否 | - | 源路径(视频文件路径或 RTSP URL) | | | └ rtspUrl | String | 否 | - | MediaMTX 提供的 RTSP URL | | | └ loop | Boolean | 否 | - | 是否循环播放 | true | | └ streamTaskId | String | 否 | - | 推流任务 ID(如果已推送到 Cloudflare) | | | └ playbackUrl | String | 否 | - | 播放地址(Cloudflare HLS/WHEP) | | | └ status | String | 否 | - | 状态 | | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": [ { "streamName": "string", "sourceType": "string", "sourcePath": "string", "rtspUrl": "string", "loop": true, "streamTaskId": "string", "playbackUrl": "string", "status": "string" } ] } ``` #### 错误码 无 ## 推流服务 Controller 推流管理 API 接口: - POST /stream/start 启动推流任务 - POST /stream/stop 停止推流任务 - GET /stream/task/{streamSn} 获取任务状态 - GET /stream/tasks 获取 LSS 推流任务列表 - GET /stream/tasks/active 获取所有活动任务 - GET /stream/channels 获取推流通道列表 - POST /stream/switch 切换推流源 ### 启动推流任务 维护人:TG Live #### URL - 本地开发环境: `POST` http://localhost:10050/api/stream/start - 开发环境: `POST` https://tg-live-game.pwtk.cc/api/stream/start 描述:启动推流任务 ContentType:`application/json` #### 请求参数 ##### Body Parameter | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | name | String | 否 | - | 任务名称 | 投币机 1 号直播 | | lssId | String | 否 | - | LSS 节点 ID(可选,不传则自动选择) | lss_001 | | cameraId | String | 否 | - | 摄像头 ID(必填) | cam_001 | | sourceRtspUrl | String | 否 | - | 源 RTSP 地址(可选,如不传则从摄像头服务获取) | rtsp://admin:password@192.168.1.101:554/stream1 | | profile | String | 否 | - | 推流配置档位: low_latency / standard / file_loop | low_latency | | whipUrl | String | 否 | - | WHIP 推流地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish | | playbackUrl | String | 否 | - | WebRTC 播放地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/play | | remark | String | 否 | - | 备注 | | #### 请求示例 ``` { "name": "投币机1号直播", "lssId": "lss_001", "cameraId": "cam_001", "sourceRtspUrl": "rtsp://admin:password@192.168.1.101:554/stream1", "profile": "low_latency", "whipUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish", "playbackUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/play", "remark": "string" } ``` #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | | 响应数据 (ActualType: StreamTaskDTO) | | | └ streamSn | String | 否 | - | 推流任务流水号 | stream_abc123def456 | | └ name | String | 否 | - | 任务名称 | 投币机 1 号直播 | | └ lssId | String | 否 | - | LSS 节点 ID | lss_001 | | └ cameraId | String | 否 | - | 摄像头 ID | cam_001 | | └ sourceRtspUrl | String | 否 | - | 源 RTSP 地址 | rtsp://admin:password@192.168.1.101:554/stream1 | | └ profile | String | 否 | - | 推流配置档位: low_latency / standard / file_loop | low_latency | | └ whipUrl | String | 否 | - | WHIP 推流地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish | | └ playbackUrl | String | 否 | - | WebRTC 播放地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/play | | └ status | String | 否 | - | 推流状态: IDLE, STARTING, STREAMING, STOPPED, ERROR | STREAMING | | └ statusDescription | String | 否 | - | 状态描述 | 推流中 | | └ errorMessage | String | 否 | - | 错误信息 | | | └ retryCount | int | 否 | - | 重试次数 | 0 | | └ remark | String | 否 | - | 备注 | | | └ createdAt | LocalDateTime | 否 | - | 创建时间 | 2024-01-15T10:30:00 | | └ startedAt | LocalDateTime | 否 | - | 开始推流时间 | 2024-01-15T10:30:05 | | └ stoppedAt | LocalDateTime | 否 | - | 停止推流时间 | yyyy-MM-dd HH:mm:ss | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": { "streamSn": "stream_abc123def456", "name": "投币机1号直播", "lssId": "lss_001", "cameraId": "cam_001", "sourceRtspUrl": "rtsp://admin:password@192.168.1.101:554/stream1", "profile": "low_latency", "whipUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish", "playbackUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/play", "status": "STREAMING", "statusDescription": "推流中", "errorMessage": "string", "retryCount": 0, "remark": "string", "createdAt": "2024-01-15T10:30:00", "startedAt": "2024-01-15T10:30:05", "stoppedAt": "yyyy-MM-dd HH:mm:ss" } } ``` #### 错误码 无 ### 停止推流任务 维护人:TG Live #### URL - 本地开发环境: `POST` http://localhost:10050/api/stream/stop - 开发环境: `POST` https://tg-live-game.pwtk.cc/api/stream/stop 描述:停止推流任务 ContentType:`application/json` #### 请求参数 ##### Body Parameter | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | ------ | ------ | ---- | -------- | ---------------------------------------------------- | ------------------- | | taskId | String | 否 | - | 推流任务流水号(与 lssId 二选一) | stream_abc123def456 | | lssId | String | 否 | - | LSS 节点 ID(与 taskId 二选一,停止该 LSS 所有推流) | lss_001 | #### 请求示例 ``` { "taskId": "stream_abc123def456", "lssId": "lss_001" } ``` #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | ---------- | ------- | ---- | -------- | --------------------------- | ------ | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | - | 响应数据 (ActualType: Void) | | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": {} } ``` #### 错误码 无 ### 获取任务状态 维护人:TG Live #### URL - 本地开发环境: `GET` http://localhost:10050/api/stream/task/{streamSn} - 开发环境: `GET` https://tg-live-game.pwtk.cc/api/stream/task/{streamSn} 描述:获取任务状态 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### Path 参数 | 名称 | 必填 | 描述 | 示例值 | | -------- | ---- | -------------- | ------------------- | | streamSn | 是 | 推流任务流水号 | stream_abc123def456 | #### 请求参数 #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | | 响应数据 (ActualType: StreamTaskDTO) | | | └ streamSn | String | 否 | - | 推流任务流水号 | stream_abc123def456 | | └ name | String | 否 | - | 任务名称 | 投币机 1 号直播 | | └ lssId | String | 否 | - | LSS 节点 ID | lss_001 | | └ cameraId | String | 否 | - | 摄像头 ID | cam_001 | | └ sourceRtspUrl | String | 否 | - | 源 RTSP 地址 | rtsp://admin:password@192.168.1.101:554/stream1 | | └ profile | String | 否 | - | 推流配置档位: low_latency / standard / file_loop | low_latency | | └ whipUrl | String | 否 | - | WHIP 推流地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish | | └ playbackUrl | String | 否 | - | WebRTC 播放地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/play | | └ status | String | 否 | - | 推流状态: IDLE, STARTING, STREAMING, STOPPED, ERROR | STREAMING | | └ statusDescription | String | 否 | - | 状态描述 | 推流中 | | └ errorMessage | String | 否 | - | 错误信息 | | | └ retryCount | int | 否 | - | 重试次数 | 0 | | └ remark | String | 否 | - | 备注 | | | └ createdAt | LocalDateTime | 否 | - | 创建时间 | 2024-01-15T10:30:00 | | └ startedAt | LocalDateTime | 否 | - | 开始推流时间 | 2024-01-15T10:30:05 | | └ stoppedAt | LocalDateTime | 否 | - | 停止推流时间 | yyyy-MM-dd HH:mm:ss | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": { "streamSn": "stream_abc123def456", "name": "投币机1号直播", "lssId": "lss_001", "cameraId": "cam_001", "sourceRtspUrl": "rtsp://admin:password@192.168.1.101:554/stream1", "profile": "low_latency", "whipUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish", "playbackUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/play", "status": "STREAMING", "statusDescription": "推流中", "errorMessage": "string", "retryCount": 0, "remark": "string", "createdAt": "2024-01-15T10:30:00", "startedAt": "2024-01-15T10:30:05", "stoppedAt": "yyyy-MM-dd HH:mm:ss" } } ``` #### 错误码 无 ### 获取 LSS 推流任务列表 维护人:TG Live #### URL - 本地开发环境: `GET` http://localhost:10050/api/stream/tasks - 开发环境: `GET` https://tg-live-game.pwtk.cc/api/stream/tasks 描述:获取 LSS 推流任务列表 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### 请求参数 ##### Query Parameter | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | ----- | ------ | ---- | -------- | ----------- | ------- | | lssId | string | 是 | - | LSS 节点 ID | lss_001 | #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | array | 否 | | 响应数据 (ActualType: List) | | | └ streamSn | String | 否 | - | 推流任务流水号 | stream_abc123def456 | | └ name | String | 否 | - | 任务名称 | 投币机 1 号直播 | | └ lssId | String | 否 | - | LSS 节点 ID | lss_001 | | └ cameraId | String | 否 | - | 摄像头 ID | cam_001 | | └ sourceRtspUrl | String | 否 | - | 源 RTSP 地址 | rtsp://admin:password@192.168.1.101:554/stream1 | | └ profile | String | 否 | - | 推流配置档位: low_latency / standard / file_loop | low_latency | | └ whipUrl | String | 否 | - | WHIP 推流地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish | | └ playbackUrl | String | 否 | - | WebRTC 播放地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/play | | └ status | String | 否 | - | 推流状态: IDLE, STARTING, STREAMING, STOPPED, ERROR | STREAMING | | └ statusDescription | String | 否 | - | 状态描述 | 推流中 | | └ errorMessage | String | 否 | - | 错误信息 | | | └ retryCount | int | 否 | - | 重试次数 | 0 | | └ remark | String | 否 | - | 备注 | | | └ createdAt | LocalDateTime | 否 | - | 创建时间 | 2024-01-15T10:30:00 | | └ startedAt | LocalDateTime | 否 | - | 开始推流时间 | 2024-01-15T10:30:05 | | └ stoppedAt | LocalDateTime | 否 | - | 停止推流时间 | yyyy-MM-dd HH:mm:ss | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": [ { "streamSn": "stream_abc123def456", "name": "投币机1号直播", "lssId": "lss_001", "cameraId": "cam_001", "sourceRtspUrl": "rtsp://admin:password@192.168.1.101:554/stream1", "profile": "low_latency", "whipUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish", "playbackUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/play", "status": "STREAMING", "statusDescription": "推流中", "errorMessage": "string", "retryCount": 0, "remark": "string", "createdAt": "2024-01-15T10:30:00", "startedAt": "2024-01-15T10:30:05", "stoppedAt": "yyyy-MM-dd HH:mm:ss" } ] } ``` #### 错误码 无 ### 获取所有活动任务 维护人:TG Live #### URL - 本地开发环境: `GET` http://localhost:10050/api/stream/tasks/active - 开发环境: `GET` https://tg-live-game.pwtk.cc/api/stream/tasks/active 描述:获取所有活动任务 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### 请求参数 #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | array | 否 | | 响应数据 (ActualType: List) | | | └ streamSn | String | 否 | - | 推流任务流水号 | stream_abc123def456 | | └ name | String | 否 | - | 任务名称 | 投币机 1 号直播 | | └ lssId | String | 否 | - | LSS 节点 ID | lss_001 | | └ cameraId | String | 否 | - | 摄像头 ID | cam_001 | | └ sourceRtspUrl | String | 否 | - | 源 RTSP 地址 | rtsp://admin:password@192.168.1.101:554/stream1 | | └ profile | String | 否 | - | 推流配置档位: low_latency / standard / file_loop | low_latency | | └ whipUrl | String | 否 | - | WHIP 推流地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish | | └ playbackUrl | String | 否 | - | WebRTC 播放地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/play | | └ status | String | 否 | - | 推流状态: IDLE, STARTING, STREAMING, STOPPED, ERROR | STREAMING | | └ statusDescription | String | 否 | - | 状态描述 | 推流中 | | └ errorMessage | String | 否 | - | 错误信息 | | | └ retryCount | int | 否 | - | 重试次数 | 0 | | └ remark | String | 否 | - | 备注 | | | └ createdAt | LocalDateTime | 否 | - | 创建时间 | 2024-01-15T10:30:00 | | └ startedAt | LocalDateTime | 否 | - | 开始推流时间 | 2024-01-15T10:30:05 | | └ stoppedAt | LocalDateTime | 否 | - | 停止推流时间 | yyyy-MM-dd HH:mm:ss | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": [ { "streamSn": "stream_abc123def456", "name": "投币机1号直播", "lssId": "lss_001", "cameraId": "cam_001", "sourceRtspUrl": "rtsp://admin:password@192.168.1.101:554/stream1", "profile": "low_latency", "whipUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish", "playbackUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/play", "status": "STREAMING", "statusDescription": "推流中", "errorMessage": "string", "retryCount": 0, "remark": "string", "createdAt": "2024-01-15T10:30:00", "startedAt": "2024-01-15T10:30:05", "stoppedAt": "yyyy-MM-dd HH:mm:ss" } ] } ``` #### 错误码 无 ### 获取推流通道列表 维护人:TG Live #### URL - 本地开发环境: `GET` http://localhost:10050/api/stream/channels - 开发环境: `GET` https://tg-live-game.pwtk.cc/api/stream/channels 描述:获取推流通道列表 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### 请求参数 #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | array | 否 | | 响应数据 (ActualType: List) | | | └ channelId | String | 否 | - | 通道 ID | cf_channel_001 | | └ name | String | 否 | - | 通道名称 | 主推流通道 | | └ mode | String | 否 | - | 推流模式: WHIP, RTMPS | WHIP | | └ hlsPlaybackUrl | String | 否 | - | HLS 播放地址 | https://customer-xxx.cloudflarestream.com/xxx/manifest/video.m3u8 | | └ recordingEnabled | boolean | 否 | - | 是否启用录制 | false | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": [ { "channelId": "cf_channel_001", "name": "主推流通道", "mode": "WHIP", "hlsPlaybackUrl": "https://customer-xxx.cloudflarestream.com/xxx/manifest/video.m3u8", "recordingEnabled": false } ] } ``` #### 错误码 无 ### 获取播放信息 维护人:TG Live #### URL - 本地开发环境: `GET` http://localhost:10050/api/stream/playback/{streamSn} - 开发环境: `GET` https://tg-live-game.pwtk.cc/api/stream/playback/{streamSn} 描述:获取播放信息 ContentType:`application/x-www-form-urlencoded;charset=UTF-8` #### Path 参数 | 名称 | 必填 | 描述 | 示例值 | | -------- | ---- | -------------- | ------------------- | | streamSn | 是 | 推流任务流水号 | stream_abc123def456 | #### 请求参数 #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | | 响应数据 (ActualType: PlaybackInfoDTO) | | | └ streamSn | String | 否 | - | 推流任务流水号 | stream_abc123def456 | | └ name | String | 否 | - | 任务名称 | 投币机 1 号直播 | | └ status | String | 否 | - | 推流状态 | STREAMING | | └ whepUrl | String | 否 | - | WHEP 播放地址(WebRTC 低延迟) | https://customer-pj89kn2ke2tcuh19.cloudflarestream.com/xxx/webRTC/play | | └ hlsUrl | String | 否 | - | HLS 播放地址 | https://customer-pj89kn2ke2tcuh19.cloudflarestream.com/xxx/manifest/video.m3u8 | | └ iframeCode | String | 否 | - | iframe 嵌入代码 | | | └ isLive | Boolean | 否 | - | 是否正在推流 | true | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": { "streamSn": "stream_abc123def456", "name": "投币机1号直播", "status": "STREAMING", "whepUrl": "https://customer-pj89kn2ke2tcuh19.cloudflarestream.com/xxx/webRTC/play", "hlsUrl": "https://customer-pj89kn2ke2tcuh19.cloudflarestream.com/xxx/manifest/video.m3u8", "iframeCode": "", "isLive": true } } ``` #### 错误码 无 ### 切换推流源 维护人:TG Live #### URL - 本地开发环境: `POST` http://localhost:10050/api/stream/switch - 开发环境: `POST` https://tg-live-game.pwtk.cc/api/stream/switch 描述:切换推流源 ContentType:`application/json` #### 请求参数 ##### Body Parameter | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | ----------- | ------ | ---- | -------- | -------------- | ----------------------------------------------- | | streamSn | String | 是 | - | 推流任务流水号 | stream_abc123def456 | | newCameraId | String | 是 | - | 新的摄像头 ID | cam_001 | | newRtspUrl | String | 是 | - | 新的 RTSP 地址 | rtsp://admin:password@192.168.1.101:554/stream1 | #### 请求示例 ``` { "streamSn": "stream_abc123def456", "newCameraId": "cam_001", "newRtspUrl": "rtsp://admin:password@192.168.1.101:554/stream1" } ``` #### 响应参数 | 名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 | | --- | --- | --- | --- | --- | --- | | success | Boolean | 否 | - | 请求是否成功 | true | | errCode | String | 否 | - | 错误码(失败时返回) | | | errMessage | String | 否 | - | 错误信息(失败时返回) | | | data | object | 否 | | 响应数据 (ActualType: StreamTaskDTO) | | | └ streamSn | String | 否 | - | 推流任务流水号 | stream_abc123def456 | | └ name | String | 否 | - | 任务名称 | 投币机 1 号直播 | | └ lssId | String | 否 | - | LSS 节点 ID | lss_001 | | └ cameraId | String | 否 | - | 摄像头 ID | cam_001 | | └ sourceRtspUrl | String | 否 | - | 源 RTSP 地址 | rtsp://admin:password@192.168.1.101:554/stream1 | | └ profile | String | 否 | - | 推流配置档位: low_latency / standard / file_loop | low_latency | | └ whipUrl | String | 否 | - | WHIP 推流地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish | | └ playbackUrl | String | 否 | - | WebRTC 播放地址 | https://customer-xxx.cloudflarestream.com/xxx/webRTC/play | | └ status | String | 否 | - | 推流状态: IDLE, STARTING, STREAMING, STOPPED, ERROR | STREAMING | | └ statusDescription | String | 否 | - | 状态描述 | 推流中 | | └ errorMessage | String | 否 | - | 错误信息 | | | └ retryCount | int | 否 | - | 重试次数 | 0 | | └ remark | String | 否 | - | 备注 | | | └ createdAt | LocalDateTime | 否 | - | 创建时间 | 2024-01-15T10:30:00 | | └ startedAt | LocalDateTime | 否 | - | 开始推流时间 | 2024-01-15T10:30:05 | | └ stoppedAt | LocalDateTime | 否 | - | 停止推流时间 | yyyy-MM-dd HH:mm:ss | #### 响应示例 ``` { "success": true, "errCode": "string", "errMessage": "string", "data": { "streamSn": "stream_abc123def456", "name": "投币机1号直播", "lssId": "lss_001", "cameraId": "cam_001", "sourceRtspUrl": "rtsp://admin:password@192.168.1.101:554/stream1", "profile": "low_latency", "whipUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/publish", "playbackUrl": "https://customer-xxx.cloudflarestream.com/xxx/webRTC/play", "status": "STREAMING", "statusDescription": "推流中", "errorMessage": "string", "retryCount": 0, "remark": "string", "createdAt": "2024-01-15T10:30:00", "startedAt": "2024-01-15T10:30:05", "stoppedAt": "yyyy-MM-dd HH:mm:ss" } } ``` #### 错误码 无