You need to enable JavaScript to run this app.
导航

更新拉流转推任务

最近更新时间2023.11.13 13:47:54

首次发布时间2023.09.25 14:34:06

创建拉流转推任务成功后,使用该接口修改任务参数。

注意事项

请求频率:单用户请求频率限制为 10 次/秒

请求说明

  • 请求方式:POST
  • 请求地址:https://live.volcengineapi.com?Action=UpdatePullToPushTask&Version=2023-01-01

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

Query

参数类型是否必选示例值描述
ActionStringUpdatePullToPushTask接口名称。当前 API 的名称为 UpdatePullToPushTask
VersionString2023-01-01接口版本。当前 API 的版本为 2023-01-01

Body

参数类型是否必选示例值描述
TitleStringtask001标题,支持中英文字符、数字,最大长度为 10 个字符
TaskIdString8fde6aa0281*********59a6e242365任务 ID,任务的唯一标识
StartTimeInteger1640891476开始时间,Unix 时间戳,单位为 s
EndTimeInteger1640891976结束时间,Unix 时间戳(秒)
CallbackURLStringhttp://example.mtime.cn/live/example/callbackapi回调地址,最大长度为 512 个字符

Type

Integer

0

拉流来源类型。支持以下 2 种取值。

  • 0:直播源;
  • 1:点播视频。

CycleMode

Integer

-1

循环模式。当 "Type":1 时,为必选参数。当 "Type":0 时,该参数无效。参数取值及含义如下所示。

  • -1:表示无限循环,至任务结束;
  • ≥1:取值表示循环的次数。
DstAddrStringrtmp://example.mtime.cn/Video/2022/02/04/mp4/190204084208765161.mp4推流地址
DomainStringpush.example.com推流域名,DstAddr 为空时必传;反之,则该参数不生效
AppStringlive推流 App 名称,DstAddr 为空时必传;反之,则该参数不生效
StreamStringstream-123转推的推流流名,DstAddr 为空时必传;反之,则该参数不生效

SrcAddr

String

http://example.mtime.cn/Video/2003/02/04/mp4/190204084208765161.mp4

拉流地址,当Type 取值为 0,即拉流来源为直播源时,为必选项。
最大长度为 1000 个字符。

SrcAddrSArray of String["http://example.mtime.cn/Video/2003/02/04/mp4/190204084208765161.mp4"]点播列表,当 Type 取值为 1,即拉流来源为点播视频时,为必选项
WatermarkObject of Watermark-水印信息

PreDownload

Integer

1

是否开启点播预热,仅对点播地址生效。

  • 0:不开启;
  • 1: 开启(默认值)。
OffsetSArray of Float[1.1]点播文件启播时间偏移值, 单位秒;数量与 SrcAddrS 列表数量相等。

ContinueStrategy

Integer

9

续播策略,支持以下配置项。

  • 0:从断流处续播(默认值);
  • 1:从断流处+自然流逝时长处续播。
OffsetFloat30点播文件启播时间偏移值,仅当 SrcAddr 不为空时生效。
PlayTimesInteger3播放次数,仅当 CycleMode 为 0 时生效。

Watermark

参数类型是否必选示例值描述

Picture

String

data:image/png;base64,iVBORw0KGg\*\*\*\*mCC

水印图片字符串,图片最大 2MB,最小 100Bytes,最大分辨率为 1080×1080。图片 Data URL 格式为:data:[<mediatype>];[base64],<data>

  • mediatype:图片类型,支持 png、jpg、jpeg 格式;
  • data:base64 编码的图片字符串。
    例如,data:image/png;base64,iVBORw0KGg****mCC
RelativePosXFloat0.1水平偏移,表示水印左侧边与转码流画面左侧边之间的距离,使用相对比率,取值范围为 [0,1)
RelativePosYFloat0.1垂直偏移,表示水印顶部边与转码流画面顶部边之间的距离,使用相对比率,取值范围为 [0,1)
RatioFloat0.1水印宽度,占直播原始画面宽度百分比,支持精度,小数点后两位

返回参数

本接口无特有的返回参数。更多信息请见返回结构

示例

请求示例

POST https://live.volcengineapi.com?Action=UpdatePullToPushTask&Version=2023-01-01
{
  "Type": 0,
  "DstAddr": "rtmp://example.mtime.cn/Video/2022/02/04/mp4/190204084208765161.mp4",
  "EndTime": 1640891476,
  "SrcAddr": "http://example.mtime.cn/Video/2003/02/04/mp4/190204084208765161.mp4",
  "TaskId": "8fde6aa0281d9f6e15e6059a6e242365",
  "StartTime": 1640841476,
  "Title": "suexample007",
  "CallbackURL": "http://example.mtime.cn/live/example/callbackapi"
}

返回示例

{
  "ResponseMetadata": {
    "RequestId": "202112311522300102252431180946DD57",
    "Action": "UpdatePullToPushTask",
    "Version": "2023-01-01",
    "Service": "live",
    "Region": "cn-north-1"
  }
}

错误码

下表仅列出本接口特有的错误码。更多信息请参见公共错误码获取详细信息。

状态码错误码错误信息说明
200CommonErr-未分类错误。建议重试,如果仍返回该错误码,请联系技术支持
400InvalidParam-输入的参数无效或不符合要求,请参照请求参数说明进行检查。
400InvalidParam.BindErrorRequest parameter error, please check input data参数未通过校验,请检查参数类型是否正确。
400InvalidParam.Format%s format error参数格式错误,请检查错误消息中指定参数中是否存在非法字符或 URL 格式错误。
400InvalidParam.OutOfRange%s should be one of {[%s]}%s should be between %d and %d参数超出允许范围,请检查错误消息中指定参数的取值是否超出取值范围。
403RequestForbidden-请求被拒绝,当前账号下无请求的资源(域名空间、域名、应用、配置模版、证书)。
403RequestForbidden.AccountIDNotAllowthis AccountID does not have permission to access the corresponding resource, please check the request parameters请求被拒绝,当前账号下无请求的资源(域名空间、域名、应用、配置模版、证书)。
403RequestForbidden.BillingStatusBilling status is not available for the AccountID, please activate the service or recharge.未开通视频直播服务或账号欠费,造成账单不可用,请检查服务开通情况和账号欠费情况。
404ResourceNotFound-未找到资源(域名空间、域名、应用、配置模版、证书)。建议重试,如果仍返回该错误码,请联系技术支持
429RequestLimitExceeded-请求创建的资源(域名空间、域名、应用、配置模版、证书)超出限制。
500InternalErroran internal error occurred, please contact the administrator.出现内部错误,请联系技术支持
502InternalServiceErroran internal error occurred, please contact the administrator.服务间出现错误,请联系技术支持
502InternalServiceError.BadResponsean internal error occurred, please contact the administrator.服务间出现错误,请联系技术支持
504InternalServiceTimeoutInternal Service is timeout. please contact the administrator.内部服务超时,请联系技术支持