视频直播 Live
视频直播 Live
- 最新动态
- 功能总览
- 服务公告
- 产品介绍
- 产品彩页
- 计费说明
- 云直播
- 媒体直播
- 最佳实践
- 云直播API参考
- 媒体直播API参考
- 云直播服务端SDK参考
- 低时延客户端SDK参考
- 场景代码示例
-
常见问题
- 高频问题导航
- 产品咨询
-
计费购买
- 点播的流量包直播服务能用吗?
- 如何查看直播套餐包的使用详情?
- 直播套餐包是否支持退订?
- 直播套餐包使用完之后会被停服吗?
- 购买了直播CDN出流包,为什么还会从账户余额扣费?
- 购买云直播转码套餐后,产生的转码费用未从套餐包中抵扣?
- 如何估算视频直播的流量消耗?
- 云直播录制需要收取哪些费用?
- 视频直播有哪些计费项?如何知道自己需要支付哪些费用?
- 如何查看直播按需资源的使用量和消费金额?
- 如何修改直播服务的计费方式?
- 不使用时是否需要停用或删除直播服务?
- 直播流量计费是按下行流量还是上行流量?
- 为什么账户欠费后仍一直产生直播费用?
- 视频直播服务的Key防盗链功能是否收费?
- 云直播转码是如何计费的?
- 如何知道账户是否欠费?
- 日峰值带宽是指上行带宽还是下行带宽?
- 为什么每月1号都会扣除一笔录制费用?
-
域名管理
- 什么是ICP备案?
- ICP备案是否是必须的?
- 如何进行ICP备案?
- 为什么要进行资质审核?审核未通过有什么影响?
- 域名已备案,如何在直播中添加域名?
- 直播服务许可证是否是必须的?如何办理?
- 添加域名时,提示“ICP编号不存在”怎么办?
- 域名管理中的消息订阅界面为什么操作不了?
- 一个租户最多可以添加多少个直播域名?
- 添加的播放域名和推流域名有什么要求?
- 域名管理界面的CNAME的作用是什么?
- 添加域名时,提示“添加失败,用户处于删除状态”怎么办?
- 为什么域名状态会从“正常”变为“配置中”?
- 配置CNAME域名解析,提示冲突?
- 播放域名和推流域名可以为二级域名吗?
- 一个域名是否可以同时添加在多个区域的直播服务中?
- 如何验证直播域名是否启动加速?
- 欠费后,域名是否会被清除掉?
- 更改了推拉流配置后,需要断流多长时间才能重新推流生效?
- 为什么直播控制台创建域名后,我的资源中未展示?
- 为什么直播控制台删除域名后,我的资源中仍展示?
- 如何查看我的资源?
-
直播录制
- 直播录制支持什么录制格式和播放格式?
- 直播录制后,为什么在控制台和回调信息中无播放地址?
- 是否支持直播录制存储至OBS桶中?
- 直播录制周期最多支持录制多长时间?
- 是否支持为每个直播流配置录制模板?
- 直播录制是否会录制转码流?
- 直播录制支持的ts分片大小是多少?
- 一次直播录制会生成几个录制文件?
- 已经删除录制规则,为什么还会生成录制文件?
- 为什么直播推流未中断,录制文件分成了两个?
- 直播录制后,如何获取录制文件地址?
- 是否支持通过调用API进行直播录制?
- 配置了录制至OBS模板,为什么未生成录制文件?
- 录制至OBS模板中,流名称是否支持通配符?
- 如何删除录制文件?
- 直播录制是否支持按需启停?
- 直播录制为什么无法收到RECORD_FILE_COMPLETE回调?
- 直播录制流名StreamName是否支持正则表达式的配置?
- 为什么直播录制生成的download_url无法下载视频?
- 修改了录制规则及文件存储路径,为什么没有生效?
- 直播中断流多次,可以录制成一个文件吗?
- 直播转码
- 直播截图
- 直播安全
- 直播推流
- 直播播放
- 直播回调
- API使用
- 统计分析
- 第三方工具使用
- 故障排除
- 视频帮助
- 文档下载
- 通用参考
更新时间:2024-12-05 GMT+08:00
链接复制成功!
新增、修改直播推流通知配置
功能介绍
新增、修改直播推流通知配置
调用方法
请参见如何调用API。
URI
PUT /v1/{project_id}/notifications/publish
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID,获取方法请参考获取项目ID。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
domain |
是 |
String |
推流域名 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
用户Token,使用Token鉴权方式时必选。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
url |
是 |
String |
回调地址 |
auth_sign_key |
否 |
String |
鉴权密钥 |
call_back_area |
否 |
String |
接收回调通知服务器所在区域。 包含如下取值:
|
响应参数
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
请求示例
PUT https://{endpoint}/v1/{project_id}/notifications/publish?domain=push.example.com { "url" : "https://endpoint.com/v1/test" }
响应示例
状态码: 400
推流通知配置修改失败
{ "error_code" : "LIVE.100011001", "error_msg" : "Request Illegal" }
SDK代码示例
SDK代码示例如下。
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.live.v1.region.LiveRegion; import com.huaweicloud.sdk.live.v1.*; import com.huaweicloud.sdk.live.v1.model.*; public class UpdatePublishTemplateSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); LiveClient client = LiveClient.newBuilder() .withCredential(auth) .withRegion(LiveRegion.valueOf("<YOUR REGION>")) .build(); UpdatePublishTemplateRequest request = new UpdatePublishTemplateRequest(); CallbackUrl body = new CallbackUrl(); body.withUrl("https://endpoint.com/v1/test"); request.withBody(body); try { UpdatePublishTemplateResponse response = client.updatePublishTemplate(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdklive.v1.region.live_region import LiveRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdklive.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = LiveClient.new_builder() \ .with_credentials(credentials) \ .with_region(LiveRegion.value_of("<YOUR REGION>")) \ .build() try: request = UpdatePublishTemplateRequest() request.body = CallbackUrl( url="https://endpoint.com/v1/test" ) response = client.update_publish_template(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" live "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/live/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/live/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/live/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). Build() client := live.NewLiveClient( live.LiveClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.UpdatePublishTemplateRequest{} request.Body = &model.CallbackUrl{ Url: "https://endpoint.com/v1/test", } response, err := client.UpdatePublishTemplate(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
推流通知配置修改成功 |
201 |
推流通知配置新增成功 |
400 |
推流通知配置修改失败 |
错误码
请参见错误码。
父主题: 通知管理