| 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="media_utils.js" type="text/javascript"></script> | 8 <script src="media_utils.js" type="text/javascript"></script> |
| 9 <script src="media_source_utils.js" type="text/javascript"></script> | 9 <script src="media_source_utils.js" type="text/javascript"></script> |
| 10 <script src="encrypted_media_utils.js" type="text/javascript"></script> | 10 <script src="encrypted_media_utils.js" type="text/javascript"></script> |
| 11 <script type="text/javascript"> | 11 <script type="text/javascript"> |
| 12 var video = document.querySelector('video'); | 12 var video = document.querySelector('video'); |
| 13 | 13 |
| 14 function onTimeUpdate() { | 14 function onTimeUpdate() { |
| 15 if (video.currentTime < 1) | 15 if (video.currentTime < 1) |
| 16 return; | 16 return; |
| 17 // keyadded may be fired around the start of playback; check for it | 17 // keyadded may be fired around the start of playback; check for it |
| 18 // after a delay to avoid timing issues. | 18 // after a delay to avoid timing issues. |
| 19 if (!video.receivedKeyAdded) | 19 if (!video.receivedKeyAdded) |
| 20 failTest('Key added event not received.'); | 20 failTest('Key added event not received.'); |
| 21 if (video.isHeartbeatExpected && !video.receivedHeartbeat) | 21 if (video.isHeartbeatExpected && !video.receivedHeartbeat) |
| 22 failTest('Heartbeat keymessage event not received.'); | 22 failTest('Heartbeat keymessage event not received.'); |
| 23 if (video.isCdmFileIOTestExpected && !video.cdmFileIOTestPassed) |
| 24 failTest('CDM File IO test failed or test result not received.'); |
| 23 video.removeEventListener('ended', failTest); | 25 video.removeEventListener('ended', failTest); |
| 24 installTitleEventHandler(video, 'ended'); | 26 installTitleEventHandler(video, 'ended'); |
| 25 video.removeEventListener('timeupdate', onTimeUpdate); | 27 video.removeEventListener('timeupdate', onTimeUpdate); |
| 26 } | 28 } |
| 27 | 29 |
| 28 // The test completes after playing the encrypted media for 1 second and | 30 // The test completes after playing the encrypted media for 1 second and |
| 29 // getting the ended event or when an error occurs at any time. | 31 // getting the ended event or when an error occurs at any time. |
| 30 function runTest() { | 32 function runTest() { |
| 31 loadEncryptedMediaFromURL(video); | 33 loadEncryptedMediaFromURL(video); |
| 32 video.addEventListener('timeupdate', onTimeUpdate); | 34 video.addEventListener('timeupdate', onTimeUpdate); |
| 33 video.play(); | 35 video.play(); |
| 34 } | 36 } |
| 35 </script> | 37 </script> |
| 36 </body> | 38 </body> |
| 37 </html> | 39 </html> |
| OLD | NEW |