AWS Chime Service vs AWS Chime SDK, Implementation of Chime SDK with Nodejs

Amreliyaharshil
Simform Engineering
7 min readNov 27, 2023

AWS Chime SDK Integration with Node.js — A Step-by-Step Guide to Seamless Real-Time Communication.

Amazon Chime is a secure and scalable communication service offered by Amazon Web Services (AWS). Designed to simplify online meetings, video conferencing, and collaboration, AWS Chime provides a seamless experience for users to connect and collaborate from anywhere in the world. With high-quality audio and video capabilities, screen sharing, and chat functionality, AWS Chime empowers businesses to enhance their communication and collaboration workflows in a flexible and reliable manner.

The AWS Chime SDK is a set of development tools that enables developers to integrate real-time communication features into their applications. Whether you’re building a custom collaboration platform, a virtual classroom, or a healthcare application, the Chime SDK offers a range of APIs and SDKs to facilitate the integration of audio and video calling, content sharing, and messaging capabilities. Leveraging the power of AWS infrastructure, the Chime SDK provides a foundation for developers to create immersive and interactive communication experiences within their applications, all backed by the security and reliability of Amazon Web Services.

Key features of Amazon Chime

  1. Online Meetings: Amazon Chime allows users to schedule and conduct online meetings. Participants can join these meetings through a web browser or by using the Amazon Chime application.
  2. Audio and Video Conferencing: The service supports high-quality audio and video conferencing, enabling users to have face-to-face conversations and collaborate in real time.
  3. Screen Sharing: Participants in a meeting can share their screens with others, making it easy to collaborate on documents, presentations, or troubleshooting.
  4. Chat and Messaging: Amazon Chime provides chat and messaging functionality, allowing users to send text messages and files during meetings or outside of scheduled meetings.
  5. Application Integration: It offers APIs (Application Programming Interfaces) and SDKs (Software Development Kits) that developers can use to integrate Amazon Chime features into their own applications.
  6. End-to-End Encryption: Amazon Chime prioritizes security, offering end-to-end encryption for meetings, ensuring that the content of the meetings remains secure.
  7. Customizable Solutions: Developers can customize and extend Amazon Chime features to suit the specific needs of their applications or businesses.
  8. Pay-as-You-Go Pricing: Amazon Chime follows a pay-as-you-go pricing model, allowing users to pay only for the features they use without any upfront costs.

Difference between AWS Chime Service and AWS Chime SDK

AWS Chime is a set of real-time communication services provided by Amazon Web Services (AWS). It includes both the AWS Chime SDK (Software Development Kit) and the AWS Chime service. Here are the main differences between them:

AWS Chime Service

  • The AWS Chime Service is a fully-managed communication service offered by AWS.
  • It provides a set of APIs and SDKs for building applications with audio and video calling, screen sharing, and messaging features.
  • AWS Chime Service is designed to simplify the development of real-time communication applications by handling the underlying infrastructure, scaling, and global distribution.
  • This service is suitable for building a wide range of applications, from simple one-on-one video calls to complex collaboration platforms.

AWS Chime SDK

  • The AWS Chime SDK is a set of client-side libraries that developers can use to integrate real-time communication features into their own applications.
  • It provides SDKs for various platforms and programming languages, including JavaScript, iOS (Swift), Android (Java and Kotlin), and more.
  • The SDK allows developers to embed audio and video calling, screen sharing, and messaging capabilities directly into their applications without having to build these features from scratch.
  • With the AWS Chime SDK, developers have more control over the user interface and user experience of their applications.

In summary, AWS Chime Service is a fully-managed service that abstracts away much of the complexity of building real-time communication applications, while AWS Chime SDK is a set of client-side libraries that allows developers to integrate these communication features into their own applications. Depending on your project requirements, you might choose to use AWS Chime Service for a more managed solution or AWS Chime SDK for more control and customization.

Steps to implement Chime SDK JS

To implement the Amazon Chime SDK for JavaScript, begin by setting up an AWS account and creating a Chime SDK application. Then, integrate the Chime SDK into your web application, handling meeting logic and user interactions, and deploy the application with scalability and monitoring considerations.

Prerequisites

AWS Account
- Make sure you have an AWS account. If you don’t have one, you can create it on the AWS website.

Access AWS Chime SDK
- Ensure you have access to the AWS Chime SDK. You will need one AWS user with permission of AmazonChimeSDK -AmazonChimeFullAccessReview.

Development Environment
- Set up a development environment with a code editor and Node.js installed.

Installation

Make sure you have Node.js version 12 or higher. Node 14 is recommended and supported.

To add the Amazon Chime SDK for JavaScript into an existing application,
install the package directly from npm:

npm install amazon-chime-sdk-js - save

Note that Amazon Chime SDK for JavaScript targets ES2015, which is fully compatible with all supported browsers.

Meeting session

Create a meeting session in your client application.

import {
ConsoleLogger,
DefaultDeviceController,
DefaultMeetingSession,
LogLevel,
MeetingSessionConfiguration
} from 'amazon-chime-sdk-js';

const logger = new ConsoleLogger('MyLogger', LogLevel.INFO);
const deviceController = new DefaultDeviceController(logger);

// You need responses from server-side Chime API. See below for details.
const meetingResponse = /* The response from the CreateMeeting API action */;
const attendeeResponse = /* The response from the CreateAttendee or BatchCreateAttendee API action */;
const configuration = new MeetingSessionConfiguration(meetingResponse, attendeeResponse);

// In the usage examples below, you will use this meetingSession object.
const meetingSession = new DefaultMeetingSession(
configuration,
logger,
deviceController
);

Getting responses from your server application.

  • You can use an AWS SDK, the AWS Command Line Interface (AWS CLI), or the REST API to make API calls. In this section, you will use the AWS SDK for JavaScript in your server application, e.g., Node.js.
const AWS = require('aws-sdk');
const { v4: uuid } = require('uuid');

// You must use "us-east-1" as the region for Chime API and set the endpoint.
const chime = new AWS.ChimeSDKMeetings({ region: 'us-east-1' });

const meetingResponse = await chime
.createMeeting({
ClientRequestToken: uuid(),
MediaRegion: 'us-west-2', // Specify the region in which to create the meeting.
})
.promise();

const attendeeResponse = await chime
.createAttendee({
MeetingId: meetingResponse.Meeting.MeetingId,
ExternalUserId: uuid(), // Link the attendee to an identity managed by your application.
})
.promise();
  • Now securely transfer the `meetingResponse` and `attendeeResponse` objects to your client application. These objects contain all the information needed for a client application using Amazon Chime SDK for JavaScript to join the meeting.
  • The value of the MediaRegion parameter in the createMeeting() should ideally be set to one of the media regions that are closest to the user creating a meeting. An implementation can be found under the topic ‘Choosing the nearest media Region’ in the [Amazon Chime SDK Media Regions documentation](https://docs.aws.amazon.com/chime-sdk/latest/dg/chime-sdk-meetings-regions.html).

Media Pipelines

To capture or stream an Amazon Chime SDK meeting, you create media pipelines.

A media pipeline can consist of one of these pipelines:

  • Media capture — You use media capture pipelines to capture audio, video, content share streams, and meeting events and data messages. All media capture pipelines save their data to the Amazon Simple Storage Service (S3) bucket that you create. You can create one media capture pipeline per Amazon Chime SDK meeting. For more information, refer to the Pipeline creation overview later in this section.
  • Media concatenation — You use media concatenation pipelines to concatenate the artifacts from a media capture pipeline. Concatenation pipelines work independently of media capture and live connector pipelines. For more information, refer to the Creating media concatenation pipelines overview later in this section.
  • Media live connector — You use media live connector pipelines to connect to services that enable you to stream Amazon Chime SDK meetings to an RTMP endpoint. You can create up to one media live connector pipeline per Amazon Chime SDK meeting. For more information, refer to the Creating media live connector pipelines overview later in this section.
  • Media stream — You use media stream pipelines to capture individual audio for all the attendees in a meeting, plus the mixed audio generated by a media concatenation pipeline. All media stream pipelines save their data to Amazon Kinesis Video Streams (KVS). For more information, refer to the Creating media stream pipelines overview later in this section.

For more information, you can visit https://docs.aws.amazon.com/chime-sdk/latest/dg/media-pipelines.html.

            const callerInfo = await sts.getCallerIdentity().promise();
const pipelineInfo = new CreateMediaCapturePipelineCommand({
SourceType: 'ChimeSdkMeeting',
SourceArn: `arn:aws:chime::${callerInfo.Account}:meeting:${
meetingTable[requestUrl.query.title].Meeting.MeetingId
}`,
SinkType: 'S3Bucket',
SinkArn: `${captureS3Destination}/chunks/${meetingTable[requestUrl.query.title].Meeting.MeetingId}`,
ChimeSdkMeetingConfiguration:{
ArtifactsConfiguration:{
CompositedVideo: {
GridViewConfiguration: {
ContentShareLayout: 'Vertical',
},
Layout: 'GridView',
Resolution: 'FHD',
},
Content:{
State: "Disabled",
MuxType: "ContentOnly",
},
Video:{
State: "Disabled",
},
Audio:{
State: "Enabled",
MuxType: "AudioOnly"
}
}
}
});
const createdMediaCapturePipeline = await MediaPipelineClient.send(pipelineInfo);
const concatenateMedialPipelineConfig = new CreateMediaConcatenationPipelineCommand({
Sinks: [{
S3BucketSinkConfiguration:{
Destination: `${captureS3Destination}/concatenated/${meetingTable[requestUrl.query.title].Meeting.MeetingId}`,
},
Type: "S3Bucket",
}],
Sources:[{
MediaCapturePipelineSourceConfiguration:{
ChimeSdkMeetingConfiguration:{
ArtifactsConfiguration:{
Audio:{
State: "Enabled"
},
Video: {
State: "Disabled"
},
CompositedVideo:{
State: "Enabled"
},
TranscriptionMessages:{
State: "Enabled"
},
Content:{
State: "Disabled"
},
DataChannel:{
State: "Disabled"
},
MeetingEvents:{
State: "Disabled"
},
}
},
MediaPipelineArn: createdMediaCapturePipeline.MediaCapturePipeline.MediaPipelineArn,
},
Type: "MediaCapturePipeline"
}]
});

const createdMediaConcatePipeline = await MediaPipelineClient.send(concatenateMedialPipelineConfig);

Note: In the above example, a concatenated media pipeline has been created to get composite video/audio recordings and composite transcript files. As Chime SDK stores all data in chunks, this pipeline helps get complete data in a single file.

Conclusion

Node.js and the AWS Chime SDK work together to open up new and exciting possibilities for developers working with real-time communication. This combination offers an effective framework to investigate and use in the context of development.

Through a smooth integration of the Chime SDK’s capabilities with Node.js apps, developers may create interactive, feature-rich, scalable communication platforms. Chime SDK’s symbiotic partnership with Node.js is a prime example of how skilled modern developers are at crafting immersive and captivating user experiences that range from cutting-edge collaboration tools to dynamic video conferencing.

For more updates on the latest development trends, follow the Simform Engineering blog.

Follow Us: Twitter | LinkedIn

--

--