Installation

You can use the client library to integrate your app with the Senza platform. There are two ways to use the library:

  1. Download an NPM package
  2. Link to the library using a script tag

NPM Package

You can install the NPM package using this command:

npm install senza-sdk

Or if your app has a package.json file, you can add it as a dependency like this:

{
  "name": "myapp",
  "version": "1.0.0",
  "dependencies": {
    "senza-sdk": "^3.19.10",
  }
}

You can then import functions and objects from the module in your app:

import { init, uiReady, lifecycle, remotePlayer } from "senza-sdk";

You'll need to use a tool like webpack to bundle the assets into your app.

Script Tag

The client library can be imported using a script tag like this:

<head>
  <script src="https://senza-sdk.streaming.synamedia.com/latest/bundle.js" defer></script>
</head>

If you link to the client library in this way you'll need to prepend senza. to all library calls.

window.addEventListener("load", async () => {
  try {
    await senza.init();
    senza.uiReady();
  } catch (e) {
    console.error(e);
  }
});

This method is compatible with older web apps, and doesn't require using webpack.


What’s Next