更新时间:2024-04-11 GMT+08:00
分享

修改频道入流信息

功能介绍

修改频道入流信息。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

PUT /v1/{project_id}/ott/channels/input

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方法请参考获取项目ID

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token,使用Token鉴权方式时必选。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

Access-Control-Allow-Internal

String

服务鉴权Token,服务开启鉴权,必须携带Access-Control-Allow-Internal访问服务。

Access-Control-Allow-External

String

服务鉴权Token,服务开启鉴权,必须携带Access-Control-Allow-External访问服务。

表3 请求Body参数

参数

是否必选

参数类型

描述

domain

String

频道推流域名

app_name

String

组名或应用名

id

String

频道ID。频道唯一标识,为必填项

input

InputStreamInfo object

频道出流信息

表4 InputStreamInfo

参数

是否必选

参数类型

描述

input_protocol

String

频道入流协议

  • FLV_PULL

  • RTMP_PUSH

  • RTMP_PULL

  • HLS_PULL

  • SRT_PULL

  • SRT_PUSH

sources

Array of SourcesInfo objects

频道主源流信息。入流协议为RTMP_PUSH和SRT_PUSH时,非必填项。其他情况下,均为必填项。

secondary_sources

Array of SecondarySourcesInfo objects

备入流数组,非必填项。如果有备入流,则主备入流必须保证路数、codec和分辨率均一致。入流协议为RTMP_PUSH时,无需填写。

failover_conditions

FailoverConditions object

有主备入流时,当前参数为必选。入流协议为RTMP_PUSH时,无需填写。

max_bandwidth_limit

Integer

当入流协议为HLS_PULL时,最大带宽限制。 未配置会默认选择BANDWIDTH最高的流

ip_port_mode

Boolean

当推流协议为SRT_PUSH时,如果配置了直推源站,编码器不支持输入streamid,需要打开设置为true

表5 SourcesInfo

参数

是否必选

参数类型

描述

url

String

频道源流URL,用于外部拉流

bitrate

Integer

码率。无需直播转码时,此参数为必填项

单位:bps。取值范围:0 - 104,857,600(100Mbps)

width

Integer

分辨率对应宽的值,非必填项

取值范围:0 - 4096(4K)

height

Integer

分辨率对应高的值,非必填项

取值范围:0 - 2160(4K)

enable_snapshot

Boolean

描述是否使用该流做截图

bitrate_for3u8

Boolean

是否使用bitrate来固定码率。默认值:false

passphrase

String

协议为SRT_PUSH时的加密信息

backup_urls

Array of strings

备入流地址列表

stream_id

String

协议为SRT_PULL时,拉流地址的streamid

latency

Integer

协议为SRT_PULL时,拉流时延

表6 SecondarySourcesInfo

参数

是否必选

参数类型

描述

url

String

频道源流URL,用于外部拉流

bitrate

Integer

码率。无需直播转码时,此参数为必填项

单位:bps。取值范围:0 - 104,857,600(100Mbps)

width

Integer

分辨率对应宽的值,非必填项

取值范围:0 - 4096(4K)

height

Integer

分辨率对应高的值,非必填项

取值范围:0 - 2160(4K)

bitrate_for3u8

Boolean

是否使用bitrate来固定码率。默认值:false

passphrase

String

协议为SRT_PUSH时的加密信息

backup_urls

Array of strings

备入流地址列表

stream_id

String

协议为SRT_PULL时,拉流地址的streamid

latency

Integer

协议为SRT_PULL时,拉流时延

表7 FailoverConditions

参数

是否必选

参数类型

描述

input_loss_threshold_msec

Integer

入流停止的时长阈值。到达此阈值后,自动触发主备切换

单位:毫秒,取值范围:0 - 3600000

input_preference

String

以主入流URL为第一优先级(PRIMARY)或主备URL平等切换(EQUAL)

如果为平等切换时使用的是备URL,无需手工切换到主URL

响应参数

状态码: 200

表8 响应Body参数

参数

参数类型

描述

result_code

String

错误码

result_msg

String

错误描述

domain

String

推流域名

app_name

String

组名或应用名,为必填项

id

String

频道ID。频道唯一标识,为必填项

sources

Array of SourceRsp objects

推流URL列表。创建频道时,只有入流协议为RTMP_PUSH时,会返回推流URL列表

表9 SourceRsp

参数

参数类型

描述

url

String

RTMP推流地址

bitrate

Integer

码率。

单位:bps。取值范围:0 - 104,857,600(100Mbps)

width

Integer

分辨率对应宽的值。取值范围:0 - 4096(4K)

height

Integer

分辨率对应高的值。取值范围:0 - 2160(4K)

enable_snapshot

Boolean

描述是否使用该流做截图

状态码: 400

表10 响应Body参数

参数

参数类型

描述

result_code

String

错误码

result_msg

String

错误描述

domain

String

推流域名

app_name

String

组名或应用名,为必填项

id

String

频道ID。频道唯一标识,为必填项

请求示例

PUT https://{endpoint}/v1/{project_id}/ott/channels/input

{
  "domain" : "push.testott.hls.com",
  "app_name" : "ott",
  "id" : "test",
  "input" : {
    "input_protocol" : "RTMP_PUSH",
    "sources" : [ {
      "width" : 100,
      "bitrate_for3u8" : false,
      "enable_snapshot" : false,
      "bitrate" : 1024,
      "passphrase" : "",
      "url" : "http://192.168.8.158/ott/adtestdrm.flv?vhost=pull.testott.hls.com",
      "height" : 100
    } ]
  }
}

响应示例

状态码: 200

Demo Information

{
  "result_code" : "LIVE.100000000",
  "result_msg" : "SUCCESS",
  "domain" : "push.testott.hls.com",
  "app_name" : "ott",
  "id" : "test"
}

状态码: 400

Error response

{
  "result_code" : "LIVE.103011019",
  "result_msg" : "The resource to access is not exists",
  "domain" : "push.testott.hls.com",
  "app_name" : "test",
  "id" : "test-abc"
}

状态码

状态码

描述

200

Demo Information

400

Error response

错误码

请参见错误码

分享:

    相关文档

    相关产品