OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Encrypted Media Player</title> | 4 <title>Encrypted Media Player</title> |
5 </head> | 5 </head> |
6 <body onload="runTest();"> | 6 <body onload="runTest();"> |
7 <video controls></video> | 7 <video controls></video> |
8 <script src="encrypted_media_utils.js" type="text/javascript"></script> | 8 <script src="encrypted_media_utils.js" type="text/javascript"></script> |
9 <script type="text/javascript"> | 9 <script type="text/javascript"> |
10 var video = document.querySelector('video'); | 10 var video = document.querySelector('video'); |
11 | 11 |
12 function onTimeUpdate() { | 12 function onTimeUpdate() { |
13 // webkitkeyadded should have been fired before playback. | 13 // webkitkeyadded should have been fired before playback. |
14 if (!video.hasKeyAdded) | 14 if (!video.receivedKeyAdded) |
15 failTest('Key not added.'); | 15 failTest('Key added event not received.'); |
16 if (video.currentTime < 1) | 16 if (video.currentTime < 1) |
17 return; | 17 return; |
| 18 if (video.isHeartbeatExpected && !video.receivedHeartbeat) |
| 19 failTest('Heartbeat keymessage event not received.'); |
18 video.removeEventListener('ended', failTest); | 20 video.removeEventListener('ended', failTest); |
19 installTitleEventHandler(video, 'ended'); | 21 installTitleEventHandler(video, 'ended'); |
20 video.removeEventListener('timeupdate', onTimeUpdate); | 22 video.removeEventListener('timeupdate', onTimeUpdate); |
21 } | 23 } |
22 | 24 |
23 // The test completes after playing the encrypted media for 1 second and | 25 // The test completes after playing the encrypted media for 1 second and |
24 // getting the ended event or when an error occurs at any time. | 26 // getting the ended event or when an error occurs at any time. |
25 function runTest() { | 27 function runTest() { |
26 loadEncryptedMediaFromURL(video); | 28 loadEncryptedMediaFromURL(video); |
27 video.addEventListener('timeupdate', onTimeUpdate); | 29 video.addEventListener('timeupdate', onTimeUpdate); |
28 video.play(); | 30 video.play(); |
29 } | 31 } |
30 </script> | 32 </script> |
31 </body> | 33 </body> |
32 </html> | 34 </html> |
OLD | NEW |