@sitr.io/embed-sdk
v0.1.5
Published
Security-first video embed SDK with DRM support for HLS and DASH streaming.
Readme
@sitr.io/embed-sdk
Security-first video embed SDK with DRM support for HLS and DASH streaming.
Installation
npm install @sitr.io/embed-sdkUsage
Script tag (UMD)
<div id="vg-player"></div>
<script src="https://unpkg.com/@sitr.io/embed-sdk/dist/vg.js"></script>
<script>
VideoGuard.init({
apiBaseUrl: "https://api.example.com",
});
VideoGuard.mount({
el: "#vg-player",
videoId: "video-123",
userId: "user-456",
});
</script>ES modules
import VideoGuard from "@sitr.io/embed-sdk";
VideoGuard.init({
apiBaseUrl: "https://api.example.com",
});
const player = await VideoGuard.mount({
el: "#vg-player",
videoId: "video-123",
userId: "user-456",
});Mount on DOM ready
VideoGuard.init({ apiBaseUrl: "https://api.example.com" });
await VideoGuard.mountOnStart({ el: "#vg-player", videoId: "video-123", userId: "user-456" });API
VideoGuard.init(config)– Initialize the SDK withapiBaseUrland optionaltenantToken,branding, etc.VideoGuard.mount(options)– Mount the player into a target element. Returns a Promise resolving to the player DOM element.VideoGuard.mountOnStart(options)– Same asmount, but waits forDOMContentLoadedbefore mounting.
Required backend endpoints
Your API must implement:
GET {apiBaseUrl}/playback/videos/{id}– Video metadata and manifest pathsGET {apiBaseUrl}/playback/config– DRM license URLsGET {apiBaseUrl}/playback/videos/{id}/token– Playback token
Notes
- The SDK stores a persistent
vg_device_idinlocalStorage. - Supports HLS, DASH, and MP4 fallback with optional Widevine, PlayReady, and FairPlay DRM.
