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>
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);
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 [email protected]
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"
}