Creates a watermark template.

Usage notes

  • You can call this operation to create a watermark template and configure information such as the watermark content and layout in the template.
  • After you create a watermark template, you must also call the AddLiveStreamWatermarkRule operation to add a watermark rule. A live stream can contain the watermark only after the stream is re-ingested.

QPS limits

You can call this operation up to 60 times per second per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see QPS limit on an API operation in ApsaraVideo Live.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesAddLiveStreamWatermark

The operation that you want to perform. Set the value to AddLiveStreamWatermark.

TypeIntegerYes0

The type of the watermark. Valid values:

  • 0: image.
  • 1: text. Only image watermarks are supported.
NameStringYeslivewatermark****

The name of the watermark.

RefWidthIntegerYes1920

The width of the background video. Unit: pixels.

RefHeightIntegerYes1080

The height of the background video. Unit: pixels.

XOffsetFloatYes50.0

The offset of the watermark along the x-axis. Unit: pixels.

Note In this case, the value of the RefWidth parameter is used as the reference. If the OffsetCorner parameter is set to TopLeft, the value of the XOffset parameter indicates the x-axis offset of the upper-left corner of the watermark relative to that of the background video. The directions from the coordinate axes to the center of the background video are positive. In other words, the x-axis is positive toward the right.
YOffsetFloatYes100.0

The offset of the watermark along the y-axis. Unit: pixels.

Note In this case, the value of the RefHeight parameter is used as the reference. If the OffsetCorner parameter is set to TopLeft, the value of the YOffset parameter indicates the y-axis offset of the upper-left corner of the watermark relative to that of the background video. The directions from the coordinate axes to the center of the background video are positive. In other words, the y-axis is positive downward.
HeightIntegerYes200

The height of the watermark. Unit: pixels. The height of the watermark is scaled in proportion to the height of the background video.

TransparencyIntegerYes255

The transparency of the watermark. A smaller value indicates a more transparent watermark. Valid values: 0 to 255.

OffsetCornerStringYesTopRight

The location of the watermark. Valid values:

  • TopLeft: the upper-left corner.
  • TopRight: the upper-right corner.
  • BottomLeft: the lower-left corner.
  • BottomRight: the lower-right corner.
PictureUrlStringYeshttp://example.com

The URL of the watermark image.

DescriptionStringNomy watermark

The description of the watermark.

DomainStringNoexample.aliyundoc.com

The streaming domain.

Response parameters

ParameterTypeExampleDescription
TemplateIdString445409ec-7eaa-461d-8f29-4bec2eb9****

The ID of the watermark template.

RequestIdString5c6a2a0df228-4a64- af62-20e91b9676b3

The request ID.

Examples

Sample requests

http(s)://live.aliyuncs.com/?Action=AddLiveStreamWatermark
&Height=200
&Name=livewatermark****
&OffsetCorner=TopRight
&PictureUrl=http://example.com
&RefHeight=1080
&RefWidth=1920
&Transparency=255
&Type=0
&XOffset=50.0
&YOffset=100.0
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<AddLiveStreamWatermarkResponse>
<RequestId>5c6a2a0df228-4a64- af62-20e91b9676b3</RequestId>
<TemplateId>445409ec-7eaa-461d-8f29-4bec2eb9****</TemplateId>
</AddLiveStreamWatermarkResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "5c6a2a0df228-4a64- af62-20e91b9676b3",
  "TemplateId" : "445409ec-7eaa-461d-8f29-4bec2eb9****"
}

Error codes

For a list of error codes, see Service error codes.