logo
On this page

Update the mixed-stream layout


Description

You can use this method to update the mixed-stream layout settings at any time during the recording.

Request method and endpoint

  • Request method: POST
  • Request URL: https://cloudrecord-api.zego.im/?Action=UpdateLayout
  • Transmission protocol: HTTPS
  • Rate limit: 10 requests/second

Request parameters

Listed below are the parameters specific to this request. For the list of common request parameters, see Accessing Server APIs - Common parameters.

ParameterTypeRequiredDescription
TaskIdStringYesTask ID. The value is a 16-byte character string.
MixModeIntNoLayout.
  • 1: customized layout. In this layout, MixInputList is required.
  • 2 (default value): grid layout
  • 3: horizontal layout
  • 4: vertical layout
  • 5: floating layout
MixInputListArray of ObjectNoCustomized layout parameters.
For details, see MixInputList member parameters.
MixMaxResolutionStreamIdStringNoStream ID of the large screen when MixMode is set to 3, 4, or 5.

MixInputList

ParameterTypeRequiredDescription

StreamId

StringNoID of the stream to be displayed on a screen. If this parameter is not set, the stream will be matched based on its order to enter the room.
ViewTypeIntNoType of content to be displayed on a screen.
  • 1 (default value): audio and video
  • 2: whiteboard
The value 2 is valid only when whiteboard recording is enabled. This parameter can be set to 2 for only one screen. Otherwise, an error will be returned.
TopIntYesY-axis coordinate of the upper left corner of a screen on the canvas. The value ranges from 0 to 1920 and can't exceed the value of Bottom or the canvas height.
LeftIntYesX-axis coordinate of the upper left corner of a screen on the canvas. The value ranges from 0 to 1920 and can't exceed the value of Right or the canvas width.
BottomIntYesY-axis coordinate of the lower right corner of a screen on the canvas. The value ranges from 0 to 1920 and can't exceed the canvas height.
RightIntYesX-axis coordinate of the lower right corner of a screen on the canvas. The value ranges from 0 to 1920 and can't exceed the canvas width.
LayerIntYesLayer priority of a screen. When an overlap occurs between two screens, the one with a larger value of Layer will be displayed on top.
FillModeIntNoFilling mode when the aspect ratio of a video stream is different from that of the screen.
  • 1 (default value): cropping. In this mode, the video stream is scaled equally to fully fill in the screen and the content outside the screen will be cropped.
  • 2: scaling. In this mode, the video screen is scaled equally to fill in the screen and black borders will be filled in along all sides.

BackgroundImage

StringNoURL of the background image of a stream. This parameter is valid only when StreamId is set.
When the specified stream specified for a customized layout does not exist or the streaming is interrupted, the background image specified by this parameter is displayed.
  • We recommend that the resolution of the background image be the same as the output video resolution. If the resolutions are different, the background image will be stretched or compressed to fully fill in the screen.
  • The background image can be in JPG or PNG format. The maximum image size is 5 MB. If the background image download fails, the setting will be invalid.
  • HTTP and HTTPS URLs are supported.

Sample request

  • Request URL
    Untitled
    https://cloudrecord-api.zego.im/?Action=UpdateLayout
    &AppId=1234567890
    &SignatureNonce=15215528852396
    &Timestamp=1234567890
    &Signature=7a2c0f11145fb760d607a07b54825013
    &SignatureVersion=2.0
    
    1
    Copied!
  • Request message body
    Untitled
    {
        "TaskId": "xxxx",
        "MixMode": 1,
        "MixInputList": [
            {
                "StreamId": "xxxx", 
                "ViewType": 1, 
                "Top": 0, 
                "Left": 0, 
                "Bottom": 720, 
                "Right": 540, 
                "Layer": 1
            },
            {
                "StreamId": "", 
                "ViewType": 1, 
                "Top": 0, 
                "Left": 540, 
                "Bottom": 360, 
                "Right": 1080, 
                "Layer": 1
            },
            {
                "StreamId": "", 
                "ViewType": 1, 
                "Top": 360, 
                "Left": 540, 
                "Bottom": 720, 
                "Right": 1080, 
                "Layer": 1
            }
        ]
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeInt64Return code.
MessageStringDescription of the request execution result.
RequestIdStringRequest ID.

Sample response

Untitled
{
    "Code": 0,
    "Message": "succeed",
    "RequestId": "abcd123"
}
1
Copied!

Previous

Stop recording

Next

Update the whiteboard layout