2

I'm creating a meeting web application and at server side I'm using php sdk, everything is ok and I'm able to create meeting and attendees and get the returned data with ids, join tokens etc. Now I'm stucked on aws demo application client because it seems to work only with React. I've tried to embed amazon-chime-sdk-js via cdn(https://cdn.jsdelivr.net/npm/amazon-chime-sdk-js@2.10.0/build/index.min.js) but without success, console shows 2 errors:

Uncaught ReferenceError: exports is not defined at index.js:2

aws_meet.php:20 Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules

I guess this is due to the absence of modules support on browsers, right? Is there any sample with no React needing or is it mandatory to use that?

Éder Rocha
  • 1,538
  • 11
  • 29

1 Answers1

0

As the Chime SDK is in typescript you can use the typescript compiler to compile it to Javascript and then bundle it using a module bundler such as Webpack.

You can find more about it here: Web application component architecture section

Example:

git clone https://github.com/aws/amazon-chime-sdk-js.git
cd amazon-chime-sdk-js/demos/singlejs
npm run bundle

It will generate an 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>

You can find the complete example here: Chime SDK Single JS

Thank you @tahiaji for highlighting about the broken link.

Akhil Kokani
  • 109
  • 1
  • 13
  • 1
    `singlejs` is no longer available on this link. It seems that it was moved to another repo https://github.com/aws-samples/amazon-chime-sdk/tree/main/utils/singlejs – Tahiaji Sep 01 '21 at 07:43