blob: c3d7003c5bf567df59e0eb641bedc8554688d596 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Message ClearKey CENC Event</title>
<script src="../medias-enc.js"></script>
<script src="../../video-test.js"></script>
<script src="../../media-source/media-source-loader-simple.js"></script>
<script src="encrypted-media-clearKey-handler.js"></script>
<script>
const videoConf = streamMedias["simpleClearKeyMSE"].video;
function runTest() {
findMediaElement();
let emeHandler = new EncryptedMediaHandler(video, videoConf);
if (!emeHandler)
endTest();
/* Overload the onMessage callback of EncryptedMediaHandler */
emeHandler.onMessage = function(event) {
let msgStr = String.fromCharCode.apply(String, new Uint8Array(event.message));
let msgJSON = JSON.parse(msgStr);
let kid = Base64ToHex(msgJSON.kids[0]).toLowerCase();
let key = videoConf.keys[kid];
if (key)
logResult(true, "Expected Kid");
endTest();
}
let ms = new MediaSourceLoaderSimple(video);
ms.onready = function() {
logResult(true, "Media source is opened");
ms.createSourceBuffer(videoConf, 1);
};
}
</script>
</head>
<body onload="runTest()">
<video></video>
</body>
</html>