Giter Site home page Giter Site logo

liwuchen / amazon-ivs-player-web-sample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/amazon-ivs-player-web-sample

0.0 1.0 0.0 2.01 MB

This project contains code samples demonstrating how to build, package, and integrate with the Amazon IVS Player Web SDK.

Home Page: https://docs.aws.amazon.com/ivs/

License: MIT No Attribution

JavaScript 100.00%

amazon-ivs-player-web-sample's Introduction

Amazon IVS Player Web SDK Samples · Run on Repl.it

This project contains code samples demonstrating how to build, package, and integrate with the Amazon IVS Player Web SDK. You can find the Web SDK API reference and documentation here.

Requirements

  • Node 12+
  • NPM 6+
  • A browser which meets the IVS web player requirements

How to Import the SDK from NPM

The Amazon IVS Web SDK on NPM is built using Webpack using the commonjs2 library target. We recommend importing with the import statement, but any module syntax compatible with commonjs2 will work.

You need to import two files to use the SDK:

  • amazon-ivs-player/dist/assets/amazon-ivs-wasmworker.min.js
  • amazon-ivs-player/dist/assets/amazon-ivs-wasmworker.min.wasm

Please see our sample player for an example on how to import the SDK assets. However, you must also configure your build tool to properly import the SDK WebAssembly files.

How to import WebAssembly Files

The Amazon IVS Web SDK uses WebAssembly (WASM). The WASM file is included separately from the JavaScript file. There are two important steps you must take to properly import the WASM:

  • You must not transpile the WASM file. If you do, the Player will fail on setup and throw an error.
  • It is strongly suggested to stream the WASM file

Webpack's file-loader meets both of the above requirements. We have included a sample Webpack config which demonstrates how to use this to load our SDK.

You don't need to install from NPM

We also provide the Amazon IVS SDK hosted on our CDN. Cloud-hosted SDKs are easier to get started with, and do not require you to use Webpack or another build tool. There is no difference in performance between either SDK. However, the Cloud SDK does not currently support TypeScript types. Please see the sample directory below for how to use the Cloud SDK.

Setup

  1. Locally clone this repository.
  2. Install dependencies: npm install
  3. Build and host using webpack-dev-server: npm start
    • Alternatively, you can just build with npm run bundle. The dist/ folder can then be independently hosted.
  4. Navigate to the index page and select a demo.
  5. Once in the demo, open the developer tools to see relevant logs.

Code Samples

Please see each sample for detailed code comments.

Live Demo

Try out this repo in Repl.it. You can build, run, and experiment with our code without having to set it up yourself.

  1. Visit https://repl.it/github/aws-samples/amazon-ivs-player-web-sample and sign up for an account
  2. Leave the default repl.it configuration (select language: Node.js, configure the run button: npm start) and click "Done"
  3. Click the "Run" button
  4. Wait for npm install and npm start to complete. You should see Compiled successfully in the console when done
  5. Reload the page and browse the live samples in the top right window

Test Streams

License

This project is licensed under the MIT-0 License. See the LICENSE file.

amazon-ivs-player-web-sample's People

Contributors

amazon-auto avatar boushley avatar dasmalini avatar dependabot[bot] avatar johnbartos avatar neer300 avatar neerjoshtwitch avatar tonyjin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.