blob: 2b16d51d20422f1a76c12e4cf7630432250fb8e8 [file] [log] [blame]
<!DOCTYPE html>
<title>Encrypted Media Player</title>
<body onload="runTest();">
<video controls></video>
<script src="media_utils.js" type="text/javascript"></script>
<script src="media_source_utils.js" type="text/javascript"></script>
<script src="encrypted_media_utils.js" type="text/javascript"></script>
<script type="text/javascript">
var video = document.querySelector('video');
function onTimeUpdate() {
if (video.currentTime < 1)
// keyadded may be fired around the start of playback; check for it
// after a delay to avoid timing issues.
if (!video.receivedKeyAdded)
failTest('Key added event not received.');
if (video.isHeartbeatExpected && !video.receivedHeartbeat)
failTest('Heartbeat keymessage event not received.');
video.removeEventListener('ended', failTest);
installTitleEventHandler(video, 'ended');
video.removeEventListener('timeupdate', onTimeUpdate);
// The test completes after playing the encrypted media for 1 second and
// getting the ended event or when an error occurs at any time.
function runTest() {
video.addEventListener('timeupdate', onTimeUpdate);;