Search code examples
apilive-streamingagora.ioagora-web-sdk-ng

Agora Unable to Start Cloud Recording


        options1 = {
            'method': 'POST',
            'url': 'https://api.agora.io/v1/apps/' + appID + '/cloud_recording/resourceid/' + resourceId + '/mode/2/start',
            'headers': {
                'Content-Type': 'application/json',
                'Authorization': 'Basic XXX'
            },
            body: JSON.stringify({
                "cname": "lol",
                "uid": "1",
                "clientRequest": {
                  "token": token,
                  "recordingConfig": {
                    "maxIdleTime": 30,
                    "streamTypes": 2,
                    "channelType": 0,
                    "videoStreamType": 0,
                    "transcodingConfig": {
                      "height": 640,
                      "width": 360,
                      "bitrate": 500,
                      "fps": 15,
                      "mixedVideoLayout": 1,
                      "backgroundColor": "#FF0000"
                    },
                    "subscribeVideoUids": [
                      "123",
                      "456"
                    ],
                    "subscribeAudioUids": [
                      "“123”",
                      "“456”"
                    ],
                    "subscribeUidGroup": 0
                  },
                  "recordingFileConfig": {
                    "avFileType": [
                      "hls"
                    ]
                  },
                  "storageConfig": {
                    "accessKey": config.writeAccessKeyId,
                    "region": 3,
                    "bucket": config.bucket,
                    "secretKey": config.writeSecretAccessKey,
                    "vendor": 1,
                    "fileNamePrefix": [
                      "directory1",
                      "directory2"
                    ]
                  }
                }
              })

        };

        request(options1, function (error, response, body) {
            if (error) throw new Error(error);
            console.log(response.statusCode);

I referred to the Agora's Cloud Recording API. Authentication and resourceId work fine. The response.statusCode is always 404. Unable to locate the error. I tested on Postman and the URL is not working as well. May I know if any attributes are entered wrongly? Does the user have to join the channel before the recording can start?


Solution

  • In your url, you have specified mode/2/start. It should be mode/mix/start.

    You can refer the documentation here for more information: https://docs.agora.io/en/cloud-recording/cloud_recording_api_rest?platform=All%20Platforms#parameters-1