What do you want to do with Hls.js?
I have a Widevine DRM video that i can play successfully in my web app using hls.js with DRM enabled.
When i deploy similar code to my Custom Chromecast Receiver web app, using the exact same config and license server etc i get the error:
[log] > [eme] Failed to obtain access to key-system "com.widevine.alpha": NotSupportedError: Unsupported keySystem or supportedConfigurations.
What have you tried so far?
I have created the most simple Create React App and added Chromecast Receiver SDK and hls.js 1.4.4 to it so i can cast, and deployed it to Firebase so that it has https.
I load the video using this code:
playerManager.setMessageInterceptor(
cast.framework.messages.MessageType.LOAD,
async (loadRequestData) => {
const {
customData: {
content: { contentId },
},
} = loadRequestData;
var video = document.getElementById("video");
const asset = await getAsset(contentId);
const {
playbackItem: { license, manifestUrl },
} = asset;
const config = getHlsJsDrmConfig(
license?.castlabsServer,
license?.castlabsToken
);
var hls = new Hls(config);
hls.loadSource(manifestUrl);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
castDebugLogger.debug("MyCustomTag", "manifest parsed");
video.play();
});
hls.on(Hls.Events.ERROR, function (event, data) {
castDebugLogger.debug(
"MyCustomTag",
`hls error ${JSON.stringify(event)} ${JSON.stringify(data)}`
);
});
return loadRequestData;
}
);
This is currently the config that i use on my webapp and that works fine to play the DRM stream with hls.js.
Casting a non-DRM stream by the way works perfectly fine by the way with this setup, its only DRM that is an issue at the moment.
castlabsServer/castlabsToken is values i get from my backend for the license server.
{
emeEnabled: true,
debug: true,
drmSystems: {
"com.widevine.alpha": {
licenseUrl: castlabsServer,
},
"com.microsoft.playready": {
licenseUrl: castlabsServer,
},
},
licenseXhrSetup: (xhr, _url, keyContext, licenseChallenge) => {
const { keySystem } = keyContext;
if (!castlabsToken) return licenseChallenge;
if (
keySystem === "com.widevine.alpha" ||
keySystem === "com.microsoft.playready"
) {
xhr.setRequestHeader("x-dt-auth-token", castlabsToken);
}
return licenseChallenge;
},
licenseResponseCallback: (xhr, _url) => {
const { response } = xhr;
return response;
},
liveSyncDuration: 15,
}
The relevant logs are these i suppose:
[log] > Debug logs enabled for "Hls instance" in hls.js version 1.4.4
main.65ac7d8a.js:2 [log] > stopLoad
main.65ac7d8a.js:2 [log] > loadSource:https://vod.streaming.a2d.tv/c5740a45-6646-49ad-841b-458bef98c14c/b8a773d0-63d1-11ed-ac83-abe2ac99ce9a_20341341.ism/.m3u8
main.65ac7d8a.js:2 [log] > [stream-controller]: Trigger BUFFER_RESET
main.65ac7d8a.js:2 [log] > attachMedia
cast_receiver_framework.js:121 [ 1.700s] [cast.receiver.MediaManager] No need to prefetch more for now.
main.65ac7d8a.js:2 [log] > [level-controller]: manifest loaded, 4 level(s) found, first bitrate: 455000
main.65ac7d8a.js:2 [log] > 2 bufferCodec event(s) expected
main.65ac7d8a.js:2 [log] > startLoad(-1)
main.65ac7d8a.js:2 [log] > [level-controller]: Switching to level 0 from level -1
main.65ac7d8a.js:2 [log] > [audio-track-controller]: Updating audio tracks, 1 track(s) found in group:audio-aacl-128
main.65ac7d8a.js:2 [log] > [audio-track-controller]: Switching to audio-track 0 "audio" lang:undefined group:audio-aacl-128
main.65ac7d8a.js:2 [log] > [audio-stream-controller]: Reset loading state
main.65ac7d8a.js:2 [log] > [audio-stream-controller]: STOPPED->IDLE
main.65ac7d8a.js:2 [log] > [subtitle-track-controller]: Updating subtitle tracks, 1 track(s) found in "textstream" group-id
main.65ac7d8a.js:2 [log] > [level-controller]: Loading level index 0 with URI 1/1 https://vod.streaming.a2d.tv/c5740a45-6646-49ad-841b-458bef98c14c/b8a773d0-63d1-11ed-ac83-abe2ac99ce9a_20341341.ism/b8a773d0-63d1-11ed-ac83-abe2ac99ce9a_20341341-video=300000.m3u8
main.65ac7d8a.js:2 [log] > [stream-controller]: STOPPED->IDLE
main.65ac7d8a.js:2 [log] > [audio-track-controller]: loading audio-track playlist 0 "audio" lang:undefined group:audio-aacl-128
main.65ac7d8a.js:2 [log] > [audio-stream-controller]: IDLE->STOPPED
main.65ac7d8a.js:2 [log] > [audio-stream-controller]: STOPPED->WAITING_TRACK
main.65ac7d8a.js:2 [log] > [subtitle-stream-controller]: STOPPED->IDLE
main.65ac7d8a.js:2 [log] > [eme] Selecting key-system from session-keys urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed, com.microsoft.playready, com.apple.streamingkeydelivery
main.65ac7d8a.js:2 [log] > [eme] Requesting encrypted media "com.widevine.alpha" key-system access with config: [{"initDataTypes":["cenc"],"persistentState":"not-allowed","distinctiveIdentifier":"not-allowed","sessionTypes":["temporary"],"audioCapabilities":[{"contentType":"audio/mp4; codecs=\"mp4a.40.2\"","robustness":"","encryptionScheme":null}],"videoCapabilities":[{"contentType":"video/mp4; codecs=\"avc1.4D400D\"","robustness":"","encryptionScheme":null},{"contentType":"video/mp4; codecs=\"avc1.4D401E\"","robustness":"","encryptionScheme":null},{"contentType":"video/mp4; codecs=\"avc1.4D401F\"","robustness":"","encryptionScheme":null}]}]
main.65ac7d8a.js:2 [log] > [eme] Failed to obtain access to key-system "com.widevine.alpha": NotSupportedError: Unsupported keySystem or supportedConfigurations.
main.65ac7d8a.js:2 [log] > [stream-controller]: Level 0 loaded [1,1672][part-1672--1], cc [0, 0] duration:6686.28
main.65ac7d8a.js:2 [log] > [buffer-controller]: Media source opened
main.65ac7d8a.js:2 [log] > [buffer-controller]: Updating Media Source duration to 6686.280
main.65ac7d8a.js:2 [log] > [subtitle-track-controller]: Switching to subtitle-track 0 "Svenska" lang:sv group:textstream
im currently stuck, any suggestions what im doing wrong or is this not supported or a bug?
What do you want to do with Hls.js?
I have a Widevine DRM video that i can play successfully in my web app using hls.js with DRM enabled.
When i deploy similar code to my Custom Chromecast Receiver web app, using the exact same config and license server etc i get the error:
[log] > [eme] Failed to obtain access to key-system "com.widevine.alpha": NotSupportedError: Unsupported keySystem or supportedConfigurations.
What have you tried so far?
I have created the most simple Create React App and added Chromecast Receiver SDK and hls.js 1.4.4 to it so i can cast, and deployed it to Firebase so that it has https.
I load the video using this code:
This is currently the config that i use on my webapp and that works fine to play the DRM stream with hls.js.
Casting a non-DRM stream by the way works perfectly fine by the way with this setup, its only DRM that is an issue at the moment.
castlabsServer/castlabsToken is values i get from my backend for the license server.
The relevant logs are these i suppose:
im currently stuck, any suggestions what im doing wrong or is this not supported or a bug?