Home > other >  Agora cloud recording S3 Integration
Agora cloud recording S3 Integration

Time:04-26

I have been trying to implement the Agora cloud recording functionality for a few days with some difficulty. The API documentation is difficult to work with, and using their POSTMAN collection implementation I was not able to get it working properly. This is the payload sent to the /start/ endpoint, after joining the user to the channel via the web client:

{
   "cname":"$channel",
   "uid":"$uid" //unqiue user id that joins the channel,
   "clientRequest":{
      "recordingConfig":{
         "channelType":0,
         "maxIdleTime":15,
         "streamTypes":2,
         "transcodingConfig":{
            "width":640,
            "height":480,
            "fps":15,
            "bitrate":500,
            "backgroundColor":"#fff000"
         }
      },
      "recordingFileConfig":{
         "avFileType":[
            "hls",
            "mp4"
         ]
      },
      "storageConfig":{
         "accessKey":"$access",
         "secretKey":"$secret",
         "region":1, // US-EAST-2
         "bucket":"$bucketname",
         "vendor":1,
         "fileNamePrefix":[
            "recordings",
            "raw"
         ]
      }
   }
}

After receiving the response I hit the /query/ endpoint, this returns:

{
   "resourceId": "$rid",
       "serverResponse": {
           "status": 6,
           "fileList": [],
           "fileListMode": "json",
           "sliceStartTime": 0
       }
}

Sometimes it gives me:

{
    "resourceId": "$rid",
    "sid": "$sid",
    "code": 404
}

When I hit the /stop/ endpoint It returns with this:

{
    "resourceId": "$rid",
    "code": 404,
    "serverResponse": {
        "command": "StopCloudRecorder",
        "payload": {
            "message": "Failed to find worker."
        },
        "subscribeModeBitmask": 1,
        "vid": "$vid"
    }
}

CodePudding user response:

You need to provide RTC token in "clientRequest" like docs said so: https://docs.agora.io/en/cloud-recording/cloud_recording_api_start?platform=RESTful

CodePudding user response:

The issue you are facing is because the Bucket region is hardcoded as region: 1 but this might not be right region for your bucket

      "storageConfig":{
         "accessKey":"$access",
         "secretKey":"$secret",
         "region":1, // US-EAST-2 <--- Change This
         "bucket":"$bucketname",
         "vendor":1,
         "fileNamePrefix":[
            "recordings",
            "raw"
         ]
      }
   }
}

  • Related