Summary

Recording functionality is available only to Applications that have:
  • Skylink Media Relay set to "On" in the Temasys Console.
  • Recording feature set to "On" in the Temasys Console. 
  • S3 buckets configured for storage & notifications
Once an Application is properly configured to use the recording and archiving functions, you can create rooms and introduce users to those rooms, and the streams sent between peers can be recorded, mixed, and stored in an AWS S3 bucket.



Steps to enable recording functionality for your account

1.  Configure Access

If you already have recording enabled for your key, proceed to Step 2. 


The recording feature for Skylink can now be enabled on the Temasys Console. In order to access and use the recording feature, you will need to have enabled Skylink Media Relay, a PRO Plan feature, on your console.


To enable Skylink Media Relay:

  1. Click on the Application you wish to enable recording for.
  2. Select the  APP: SETTINGS tab
  3. Set the option for Skylink Media Relay to "On"


If you're not currently subscribed to our PRO plan and would like to learn more about our different Subscription Plans, please contact our Sales Team at sales@temasys.com.sg.


2.  Set up and configure an Amazon Web Services S3 Bucket to store the recordings


IMPORTANT

An Amazon Web Services (AWS) S3 Bucket must be set up and configured in order to successfully use the Temasys Skylink Recording & Archiving feature


Please refer here for guidance on the creation of an S3 bucket.
Once the S3 Bucket has been created, the following information is required to configure your Temasys account. This can be self-managed through the Temasys Console on the Recordings Configuration Page accessible under Account Settings.

  • S3 Region(s): Please enter the region where the S3 account is located / hosted. Examples: eu-west-1 , us-west-2
  • IAM Access Key Id : This is the user id of the S3 account.  A specific new user account for Skylink can be created via your AWS administration console. The User ID for the new account can be entered as the user id for the S3 bucket. Example : "KNCSIVHE52IL67WQQAQ"
  • IAM Secret Access Key: This should be the secret for the new user account that was created for Skylink. Example : "dfkdskrjekKoLoI0LkN3GY3D/PhYs2rY+r/Swu"
  • S3 Bucket Name: As you might expect, this would be the name of the S3 bucket (account/folder on AWS) where the recordings will be saved. Example "skylink-recording". An S3 bucket on AWS must be created before data can be stored there. As a result, a new S3 bucket should be created for the new user account that has been added (see "S3 Access Key Id" and "S3 Secret Access Key", above). Access privileges for the bucket will need to be specified by using the AWS Policy Generator. Although the creation of an S3 Bucket will be free, charges will be incurred for the amount of storage capacity used on S3, and for moving data in and out of the S3 bucket. For more information on setting access rules and permissions for AWS S3 buckets, please refer here.


More details on configuring S3 buckets and establishing user policies


Temasys HIGHLY recommends that you NOT share your root account with anyone including Temasys to maintain the security of your AWS account. Please create a user and IAM credentials with the appropriate access policy intended specifically for the purpose of Skylink recording. This can be done in the Identify and Access Management (IAM) section of your AWS console.
If you are unfamiliar with how to create user policies on AWS, the following tutorial may be helpful: How to create and attach a policy to a user (on AWS)


User policy example:


IMPORTANT

You will need to change the "Resource" in the following code sample ("arn:aws:s3:region::bucketname") to represent the name of the S3 bucket you have created for Skylink. This must be a bucket name, not an object identifier or virtual folder. The final block can be omitted from the example below if directory listings or browsing via an s3 client is not required.


S3 User Policy Example


{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation",
                "s3:ListBucketMultipartUploads"
            ],
            "Resource": "arn:aws:s3:region::bucketname",
            "Condition": {}
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:AbortMultipartUpload",
                "s3:DeleteObject",
                "s3:DeleteObjectVersion",
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:GetObjectVersion",
                "s3:GetObjectVersionAcl",
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:PutObjectAclVersion"
            ],
            "Resource": "arn:aws:s3:region::bucketname/*",
            "Condition": {}
        },
        {
            "Effect": "Allow",
            "Action": "s3:ListAllMyBuckets",
            "Resource": "*",
            "Condition": {}
        }
    ]
}


3.  Creating a Recording Notification 

 Requirements

  1. Application ID (mandatory)
    Access to recording and archiving is dependent upon first enabling the Temasys MCU capability, via the Temasys Console. Access to the MCU is assigned at the Application level (vs. to an Application Key). Access to recording and archiving is also enabled at the Application level due to its reliance on the Temasys MCU.
  2. URL address for HTTP POST notifications (optional)
    A notification for each recording completed is sent to this URL in the shape of an HTTP POST request as soon as mixing and recording are finished.
  3. Email address for notifications (optional)
    A notification for each recording completed is sent to this email address as soon as mixing and recording are finished.
  4. Amazon Web Services (AWS) S3 Bucket - Setup and Configuration Information
    Recordings are not stored on any Temasys server. They must be saved to a separate AWS S3 account. It is strongly recommended that a completely separate and unique S3 bucket is created specifically to store Temasys Skylink recording archives. 


         REST API call to  /rest/recording/notifications   with method as  POST to create a recording notification

         Please refer to Recording Notification API Call for further details.

 

4. Integrating Recording with SkylinkJS


Link to the Custom SkylinkJS CDN


The startRecording() and  stopRecording() functions can be used to control the recording of a call.  A  Recording session ID  is assigned to each session allow users to track each recording. You would need to subscribe to the recordingState event callback to receive callbacks with respect to the state of recording.  Once the recording is complete, the video and audio streams are combined by the mixing server, after which the recordingState event is fired with the state RECORDING_STATE.LINK.  You can use the recording session ID to map the recording to its' respective session.

If the user has already left the room, the recording will be stored in the S3 bucket specified in Step 2.


Documentation

Alternatively, you can view the complete set of documentation here: https://cdn.temasys.com.sg/skylink/skylinkjs/latest/doc/index.html


Sample Code


// Instantiate the Skylink Object.
var SkylinkDemo = new Skylink(),
 
// Handling of Recording's States
SkylinkDemo.on("recordingState", function (state, recordingId, url, error) {
   if (state === SkylinkDemo.RECORDING_STATE.START) {
      // Recording has started for session (based on ID)
   }
   else if (state === SkylinkDemo.RECORDING_STATE.STOP) {
      // Recording has stopped for session (based on ID).
      // Currently the video for the recording session is mixing and you can start a new recording session again
   }
   else if (state === SkylinkDemo.RECORDING_STATE.LINK) {
      // Recording session (based on ID) video mixin has completed and download link is available
   }
   else {
      // ERROR
   }
});
  
// Start a recording
function startRecording() {
  // Skylink function to start the recording.
  SkylinkDemo.startRecording();
}
 
// Stop a recording.
// NOTE: It is recommended to wait for 10 seconds before stopping the recording, to allow the server to correctly generate a video.
function stopRecording () {
  // Skylink function to stop the recording.
  SkylinkDemo.stopRecording();
}
  
// Initialise the Skylink object.
SkylinkDemo.init("<% RECORDING APP KEY HERE %>");



5. Recording : Demo Application


RECORDING DEMO


Instructions
  1. If you do not have an existing room ID (query:  ?room=id ), the demo will assign you a new one. 
  2.  Share the URL between different peers to establish a connection
  3. Click on the start recording. Wait for 10 seconds.
  4. For any peer, after 10 seconds, stop the recording.
  5. Once mixing is complete, you will receive a link to the recording.