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 be enabled on the Temasys Console. In order to access and use the recording feature, you will need to enable Skylink Media Relay and enable Recording on your console. 


If you're not currently subscribed to our PRO or Custom plans and would like to learn more about the different Subscription options we offer, 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.


  • Enable Notification: The flag to enable posting of notifications to the configured backend server URL or email.
  • Notification URL (optional): The backend server URL in which the server will do a HTTP POST when mixing of a recording session has completed. (Ensure that https:// or http:// protocol is configured for the URL).
  • Notification Email(s): The email address to which the server will send an email to when mixing of a recording session has been completed.
  • Amazon S3 ARN (Amazon Resource Name): The S3 ARN (Amazon Resource Name) to be used by the server.
    Format: arn:{partition}:{service}:{region}:{account-id}:{resourcetype}/{resource}. Example: arn:aws:s3:us-west-2::bucketname/objectpath *
  • Amazon S3 Access Key ID: The Amazon S3 Access Key ID to your bucket.  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 : "KBCSIVH197AB4WQONQ"
  • Amazon S3 Secret Access Key: The Amazon S3 Secret Access Key to your bucket


* bucketname refers to 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 Amazon S3 Access Key ID and Amazon 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.