Skip to content

Latest commit

 

History

History

singlejs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Bundling Chime SDK into a single .js file

This demo shows how to bundle the latest release of amazon-chime-sdk-js into a single JS file using Rollup. You'll need to have Node 14+ and npm 6.11+ on your local development machine.

git clone https://github.com/aws-samples/amazon-chime-sdk.git
cd amazon-chime-sdk/utils/singlejs
npm install
npm run bundle

It will generate amazon-chime-sdk.min.js and amazon-chime-sdk.min.js.map in the build folder. Include both files in your project and embed amazon-chime-sdk.min.js.

<script src="path/to/amazon-chime-sdk.min.js"></script>
<script src="path/to/amazon-chime-sdk.min.js.map"></script>

Using ChimeSDK

In a browser environment, window.ChimeSDK will be available. You can access Chime SDK components by component name (See the full list here). For example, you can create a meeting session and configure the meeting session using window.ChimeSDK.

const logger = new ChimeSDK.ConsoleLogger('ChimeMeetingLogs', ChimeSDK.LogLevel.INFO);
const deviceController = new ChimeSDK.DefaultDeviceController(logger);
const configuration = new ChimeSDK.MeetingSessionConfiguration(meeting, attendee);
const meetingSession = new ChimeSDK.DefaultMeetingSession(configuration, logger, deviceController);

Changing target version

You can change the version of amazon-chime-sdk-js in package.json. By default, npm run bundle uses the version of the SDK that is defined in the package. To bundle a specific version of the SDK, delete any build folder that was generated by a previous npm run bundle command, and then run npm install amazon-chime-sdk-js@x.xx.xx and specify the version of the SDK that you'd like to install. Then, run npm run bundle to generate the bundled SDK.

"dependencies": {
  "amazon-chime-sdk-js": "^3.12.0"
}