unified-video-framework
Version:
Cross-platform video player framework supporting iOS, Android, Web, Smart TVs (Samsung/LG), Roku, and more
15 lines (13 loc) • 621 B
text/typescript
import { BUNNY_NET_BASE_URL, BUNNY_NET_ENDPOINTS, BunnyNetConfig } from '../types/BunnyNetTypes';
import { ExtendedDRMConfig } from '../types/DRMTypes';
export class BunnyNetProvider {
static createConfig(bunnyConfig: BunnyNetConfig): ExtendedDRMConfig {
const base = `${BUNNY_NET_BASE_URL}/${bunnyConfig.libraryId}/${bunnyConfig.videoId}`;
return {
type: 'fairplay',
licenseUrl: `${base}${BUNNY_NET_ENDPOINTS.license}`,
certificateUrl: `${base}${BUNNY_NET_ENDPOINTS.certificate}`,
headers: bunnyConfig.token ? { 'AccessKey': bunnyConfig.token } : undefined,
};
}
}