On this page

CreateUploadTask

POST

https://cloud-player-api.zego.im/

Create an upload task to upload URL online resources to OSS. After uploading, cloud player clusters in the same region can obtain playback resources through the internal network stream URL, ensuring the stability of the resource transmission process.

Note

This feature is a value-added service. If you need to use it, please contact ZEGOCLOUD sales personnel to activate it.

Note

For a single AppID, ZEGOCLOUD server can process a maximum of 10 upload tasks simultaneously (including uploading and waiting). If you need to increase the limit, please contact ZEGOCLOUD Technical Support to modify it.

Note
Call frequency limit: 20 times/second

Request

Query Parameters

    Action stringrequired

    Possible values: [CreateUploadTask]

    API prototype parameter

    https://cloud-player-api.zego.im?Action=CreateUploadTask

    AppId uint32required

    💡Common parameter. Application Id, a unique user credential assigned by ZEGOCLOUD. Can be obtained from ZEGOCLOUD Console.

    SignatureNonce stringrequired

    💡Common parameter. 16-digit hexadecimal random string (hex encoding of 8-byte random number). For the generation algorithm, please refer to Signature Example.

    Timestamp int64required

    💡Common parameter. Current Unix timestamp, unit is seconds. For the generation algorithm, please refer to Signature Example, a maximum error of 10 minutes is allowed.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Common parameter. Signature version number.

    Signature stringrequired

    💡Common parameter. Signature, used to verify the legitimacy of the request. Please refer to Signature Mechanism for generation.

Body

required
    Title stringrequired

    Possible values: <= 100 characters

    File name, with a maximum length of 100B. The file extension (supports .mp3, .mp4, .flv, .wav, .aac, and .flac) must be retained and correct, otherwise playback may fail.

    Warning

    Do not use the same file name. If multiple files have the same Title, they will replace each other, and only the last uploaded file will be retained. However, the new file may inherit the expiration time of the old file.

    StreamUrl stringrequired

    Possible values: <= 1024 characters

    The address of the media resource, which must be a valid HTTP/HTTPS address with a length within 1024 bytes. The file size limit is 5GB.

    RetentionDays number

    Possible values: >= 1 and <= 7

    Default value: 3

    Resource validity period, unit is days. Valid value range is [1, 7], (default value: 3). If you need to increase the limit, please contact ZEGOCLOUD Technical Support for assistance.

    ContentMd5 string

    ContentMd5 is the hash value generated by calculating the file through the MD5 algorithm, and then Base64 encoded, used to verify whether the file maintains integrity during the upload process.

    If you provide the ContentMd5 parameter when uploading, ZEGOCLOUD server will calculate the ContentMd5 of the file through OSS and compare it with the value you provided. If the two are inconsistent, the upload will fail, indicating that the file may have been tampered with or damaged.

    To ensure the integrity and security of the file, it is strongly recommended to pass in the ContentMd5 parameter when uploading files.

    The following is an example of generating ContentMd5 using PHP:

    function calculateMD5($content) {
        return base64_encode(md5($content, true));
    }
    

Responses​

OK
Schema
    Code number

    Return code.

    The following only lists the return codes related to the API business logic. For the complete return codes, please refer to Global Return Codes.

    Return CodeDescriptionHandling Suggestion
    0Success.-
    100000004Signature expired.Please regenerate the signature.
    100000005Signature error.Please confirm whether the parameters for generating the signature are correct.
    350006001API request frequency exceeds the limit.Please confirm the QPS limit of the corresponding API and reduce the request frequency.
    350006002Gateway verification failed.Please contact ZEGOCLOUD Technical Support for assistance.
    350006003Invalid input parameter.Please adjust the value of the corresponding parameter according to the Message prompt.
    350006006Service not activated.Please contact ZEGOCLOUD Technical Support to activate the service permission.
    350010000System error.Please contact ZEGOCLOUD Technical Support for assistance.
    Message string

    Operation result description.

    RequestId string

    Request ID.

    Data object
    Response object.
    UploadTaskId string

    Upload task ID.

    CreateTime number

    Unix timestamp when the file upload task was successfully created, unit: seconds.

Previous

Query the task list of a cloud player

Next

Cancel an upload task

On this page

Back to top