{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/zh/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"云手机直播"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"云手机直播","__idx":0},"children":["云手机直播"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["可以通过开放 API 或本地 API 上传一个 MP4 文件、开始直播、查询状态并结束直播。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"接口路径","__idx":1},"children":["接口路径"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"操作"},"children":["操作"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"开放 API"},"children":["开放 API"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"本地 API"},"children":["本地 API"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["查询余额及余量"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /balance"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET /api/balance"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["开始直播"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/start"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/cloudphone/live/start"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["查询直播状态"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/status"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/cloudphone/live/status"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["结束直播"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/end"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/cloudphone/live/end"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"前置条件","__idx":2},"children":["前置条件"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["使用支持直播的云手机机型；不兼容机型当前会返回 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["33401"]},"。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["开始或结束直播前先将云手机开机。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["获取 OAuth2 Bearer Token，并确保当前成员具有该云手机的操作权限。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["直播文件必须是 MP4，并以 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["uploadType=2"]}," 上传。"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"开放-api-调用流程","__idx":3},"children":["开放 API 调用流程"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["调用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/uploadUrl"]},"，再使用 HTTP ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT"]}," 将 MP4 内容上传到返回的 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["presignedUrl"]},"。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["调用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/uploadFile"]},"，传入文件地址、目标目录和 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["uploadType: 2"]},"。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["轮询 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/uploadFileResult"]},"。如果 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," 为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},"，表示文件记录尚未可见，应继续轮询；当 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.status"]}," 为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]},"（成功）或 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2"]},"（失败）时停止。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["保存字符串类型的 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.fileId"]},"，并将其精确数值作为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["int64"]}," 传给 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/start"]},"。JavaScript 等客户端应使用支持任意精度整数的序列化方式，不能先转换为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Number"]},"。"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"phoneId\": 190000000000000001,\n  \"fileId\": 820000000000000001\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["使用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/status"]}," 查询直播状态，使用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/end"]}," 结束直播。这两个接口均接收 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{ \"phoneId\": 190000000000000001 }"]},"。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"本地-api-调用流程","__idx":4},"children":["本地 API 调用流程"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["调用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/cloudphone/upload/file/signedUrl"]},"，再使用 HTTP ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT"]}," 将 MP4 内容上传到返回的 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["presignedUrl"]},"。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["调用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/cloudphone/upload/file"]},"，传入文件地址、目标目录和 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["uploadType: 2"]},"。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["轮询 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/cloudphone/upload/file/result"]},"。如果 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," 为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},"，应继续轮询；当 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.status"]}," 为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]}," 或 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2"]}," 时停止。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["将返回的 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.fileId"]}," 精确数值传给 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /api/cloudphone/live/start"]},"；使用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/cloudphone/live/status"]}," 和 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api/cloudphone/live/end"]}," 查询或结束直播。"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["完整请求和响应结构参见",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/zh/api-reference/cloud-phone/open-api"},"children":["云手机开放 API"]},"和",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/zh/api-reference/cloud-phone/local-api"},"children":["云手机本地 API"]},"。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"重试与错误处理","__idx":5},"children":["重试与错误处理"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["开始直播请求超时后，应先查询状态再决定是否重试，不能将超时直接视为启动失败。"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"错误码"},"children":["错误码"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"含义"},"children":["含义"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["33300"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["云手机不存在"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["33301"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["云手机未开机"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["33401"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["当前云手机不支持直播"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["33418"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["直播文件不存在或已失效"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["33419"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/cloudphone/uploadFile"]}," 拒绝了非 MP4 的直播文件"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["99002"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["当前成员无权操作该云手机"]}]}]}]}]}]},"headings":[{"value":"云手机直播","id":"云手机直播","depth":1},{"value":"接口路径","id":"接口路径","depth":2},{"value":"前置条件","id":"前置条件","depth":2},{"value":"开放 API 调用流程","id":"开放-api-调用流程","depth":2},{"value":"本地 API 调用流程","id":"本地-api-调用流程","depth":2},{"value":"重试与错误处理","id":"重试与错误处理","depth":2}],"frontmatter":{"seo":{"title":"云手机直播"}},"lastModified":"2026-09-10T13:09:25.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/zh/api-reference/cloud-phone/live-streaming","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}