blob: bfd6d31138c418855e344a62e0489380e692367c [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Encrypted ClearKey CENC Event</title>
<script src="../medias-enc.js"></script>
<script src="../../video-test.js"></script>
<script>
var onEncryptedEvent;
function runTest() {
if (!navigator.requestMediaKeySystemAccess) {
logResult(false, "EME API is not supported");
return;
} else {
logResult(true, "EME API is supported");
}
findMediaElement();
waitForEventOn(video, "encrypted", encrypted);
function encrypted(event) {
onEncryptedEvent = event;
testExpected("onEncryptedEvent.target", video);
testExpected("onEncryptedEvent", window.MediaEncryptedEvent, "instanceof");
testExpected("onEncryptedEvent.initDataType.toLowerCase()", "cenc");
testExpected("onEncryptedEvent.initData", null, "!=");
endTest();
}
const source = document.createElement('source');
source.setAttribute("src", streamMedias["simpleClearKey"].video.path);
source.setAttribute("type", streamMedias["simpleClearKey"].video.mimeType);
video.appendChild(source);
video.play();
}
</script>
</head>
<body onload="runTest()">
<video></video>
</body>
</html>