@byteark/passport-clearkey-web-sdk
v0.4.1
Published
Passport ClearKey Web SDK — cookie-based auth loader for HLS ClearKey playback
Keywords
Readme
@byteark/passport-clearkey-web-sdk
Lightweight wrapper for the Passport ClearKey Web SDK for HLS ClearKey playback.
Install
npm install @byteark/passport-clearkey-web-sdkSetup
Add the hosted SDK script to your HTML before using this package.
Replace VERSION with the version you want to use (e.g. 0.3.0):
<script src="https://byteark-sdk.st-th-1.byteark.com/passport-clearkey/web-sdk/VERSION/passport-web-sdk.js"></script>Usage
import { loadPassportWebSDK } from '@byteark/passport-clearkey-web-sdk';
const sdk = await loadPassportWebSDK();
// Initialize authentication
const result = await sdk.initAuth(jwt, keyServerBaseUrl);
// Get the XHR setup function for hls.js
const xhrSetup = sdk.getXhrSetup();API
loadPassportWebSDK(): Promise<PassportWebSDK | null>
Returns the PassportWebSDK instance from window.PassportWebSDK.
Resolves to null in server-side environments.
Throws if the hosted SDK <script> tag has not been loaded.
PassportWebSDK
| Method | Description |
|---|---|
| initAuth(jwt, keyServerBaseUrl) | Initialize cookie-based auth session |
| renewSession() | Renew the current session |
| getXhrSetup() | Returns an XHR setup function for hls.js xhrSetup config |
| destroy() | Clean up the SDK instance |
License
UNLICENSED
