All Products
Search
Document Center

Object Storage Service:PutLiveChannel

Last Updated:Jun 10, 2026

Creates a LiveChannel for uploading audio and video data over RTMP. The response returns the RTMP ingest URL and the corresponding playback URL.

Note

You can use the returned URLs to ingest and play streams. You can also use the LiveChannel name to query stream ingest status, query stream ingest records, and disable stream ingestion.

Permissions

By default, an Alibaba Cloud account has full permissions. RAM users or RAM roles under an Alibaba Cloud account do not have any permissions by default. The Alibaba Cloud account or account administrator must grant operation permissions through RAM policies or Bucket Policy.

API

Action

Description

PutLiveChannel

oss:PutLiveChannel

Creates a LiveChannel before you upload audio and video data by using the Real-Time Messaging Protocol (RTMP).

Request syntax

PUT /ChannelName?live HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT date
Content-Length: Size
Authorization: SignatureValue
<?xml version="1.0" encoding="UTF-8"?>
<LiveChannelConfiguration>
  <Description>ChannelDescription</Description>
  <Status>ChannelStatus</Status>
  <Target>
     <Type>HLS</Type>
     <FragDuration>FragDuration</FragDuration>
     <FragCount>FragCount</FragCount>
     <PlaylistName>PlaylistName</PlaylistName>
  </Target>
  <Snapshot>
    <RoleName>Snapshot ram role</RoleName>
    <DestBucket>Snapshot dest bucket</DestBucket>
    <NotifyTopic>Notify topic of MNS</NotifyTopic>
    <Interval>Snapshot interval in second</Interval>
  </Snapshot>
</LiveChannelConfiguration>

Request headers

Header

Type

Required

Description

ChannelName

String

Yes

The name of the LiveChannel to create. Must comply with the object naming conventions and cannot contain forward slashes (/).

Request parameters

Parameter

Type

Required

Description

LiveChannelConfiguration

Container

Yes

The container for LiveChannel configurations.

Child nodes: Description, Status, and Target

Parent nodes: none

Description

String

No

The description of the LiveChannel. Maximum length: 128 bytes.

Child nodes: none

Parent nodes: LiveChannelConfiguration

Status

Enumerated string

No

The status of the LiveChannel.

Child nodes: none

Parent nodes: LiveChannelConfiguration

Valid values: enabled and disabled

Default value: enabled

Target

Container

Yes

The container for configurations that the LiveChannel uses to store uploaded data.

Child nodes: Type, FragDuration, FragCount, and PlaylistName

Parent nodes: LiveChannelConfiguration

Type

Enumerated string

Yes

The storage format for uploaded data.

Child nodes: none

Parent nodes: Target

Valid value: HLS

Note
  • When Type is set to HLS, OSS updates the m3u8 file each time a ts file is generated. The m3u8 file contains at most the number of latest ts files specified by FragCount.

  • When Type is set to HLS and the current ts file exceeds the FragDuration, OSS switches to the next ts file before the next key frame arrives. If no key frame arrives after max(2*FragDuration, 60s), OSS forces a switch to the next ts file, which may cause playback stuttering.

FragDuration

String

No

The duration of each ts file when Type is set to HLS.

Unit: seconds

Child nodes: none

Parent nodes: Target

Valid values: [1, 100]

Default value: 5

Note

If neither FragDuration nor FragCount is specified, default values apply. You must specify both parameters at the same time.

FragCount

String

No

The number of ts files in the m3u8 file when Type is set to HLS.

Child nodes: none

Parent nodes: Target

Valid values: [1, 100]

Default value: 3

Note

If neither FragDuration nor FragCount is specified, default values apply. You must specify both parameters at the same time.

PlaylistName

String

No

The name of the generated m3u8 file when Type is set to HLS. Must be 6 to 128 bytes in length and end with .m3u8.

Child nodes: none

Parent nodes: Target

Default value: playlist.m3u8

Snapshot

Container

No

The container for high-frequency snapshot options.

Child nodes: RoleName, DestBucket, NotifyTopic, and Interval

Parent nodes: LiveChannelConfiguration

RoleName

String

No

The RAM role for high-frequency snapshot operations. The role must have write permissions on DestBucket and permissions to send messages to NotifyTopic.

Child nodes: none

Parent nodes: Snapshot

DestBucket

String

No

The bucket for storing high-frequency snapshot results. Must belong to the same owner as the current bucket.

Child nodes: none

Parent nodes: Snapshot

NotifyTopic

String

No

The MNS topic for notifying users of high-frequency snapshot results.

Child nodes: none

Parent nodes: Snapshot

Interval

NUMERIC

Yes

The interval for high-frequency snapshots. If no key frame (such as an I-frame) exists within the interval, no snapshot is captured.

Unit: seconds

Child nodes: none

Parent nodes: Snapshot

Valid values: [1, 100]

By default, this parameter is left empty.

Response parameters

Parameter

Type

Description

CreateLiveChannelResult

Container

The container for the CreateLiveChannel response.

Child nodes: PublishUrls and PlayUrls

Parent nodes: none

PublishUrls

Container

The container for the stream ingest URL.

Child nodes: Url

Parent nodes: CreateLiveChannelResult

Url

String

The stream ingest URL.

Child nodes: none

Parent nodes: PublishUrls

Note
  • The ingest URL is not signed. If the bucket ACL is not public read/write, you must sign the URL before use.

  • The playback URL is not signed. If the bucket ACL is private, you must sign the URL before use.

PlayUrls

Container

The container for the stream playback URL.

Child nodes: Url

Parent nodes: CreateLiveChannelResult

Url

String

The stream playback URL.

Child nodes: none

Parent nodes: PlayUrls

Examples

Sample request

PUT /test-channel?live HTTP/1.1
Date: Wed, 24 Aug 2016 11:11:28 GMT
Content-Length: 333
Host: test-bucket.oss-cn-hangzhou.aliyuncs.com
Authorization: OOSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=content-length,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
<LiveChannelConfiguration>
    <Description/>
    <Status>enabled</Status>
    <Target>
        <Type>HLS</Type>
        <FragDuration>2</FragDuration>
        <FragCount>3</FragCount>
    </Target>
    <Snapshot>
        <RoleName>role_for_snapshot</RoleName>
        <DestBucket>snapshotdest</DestBucket>
        <NotifyTopic>snapshotnotify</NotifyTopic>
        <Interval>1</Interval>
     </Snapshot>
</LiveChannelConfiguration>

Sample response

HTTP/1.1 200
content-length: 259
server: AliyunOSS
x-oss-server-time: 4
connection: close
x-oss-request-id: 57BD8419B92475920B0002F1
date: Wed, 24 Aug 2016 11:11:28 GMT
x-oss-bucket-storage-type: standard
content-type: application/xml

<?xml version="1.0" encoding="UTF-8"?>
<CreateLiveChannelResult>
  <PublishUrls>
    <Url>rtmp://test-bucket.oss-cn-hangzhou.aliyuncs.com/live/test-channel</Url>
  </PublishUrls>
  <PlayUrls>
    <Url>http://test-bucket.oss-cn-hangzhou.aliyuncs.com/test-channel/playlist.m3u8</Url>
  </PlayUrls>
</CreateLiveChannelResult>