| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <html lang="en"> | |
| 3 <head> | |
| 4 </head> | |
| 5 <body> | |
| 6 <video></video> | |
| 7 <p>Test Encrypted Media extension of HTMLMediaElement <em>canPlayType()<
/em> method.</p> | |
| 8 <p>The test is designed to pass with any implementation regardless of su
pported media types and relies on the expected log to detect the expected result
s for some types. | |
| 9 To get sufficient coverage, it is important that an implementation su
pport clearkey encryption of at least one of the types below.</p> | |
| 10 | |
| 11 <script src=../../video-test.js></script> | |
| 12 <script> | |
| 13 video = mediaElement = document.getElementsByTagName('video')[0]; | |
| 14 | |
| 15 consoleWrite("<br>Always return the empty string for an empty type."
); | |
| 16 testExpected("video.canPlayType('')", ""); | |
| 17 testExpected("video.canPlayType('', '')", ""); | |
| 18 testExpected("video.canPlayType('', null)", ""); | |
| 19 testExpected("video.canPlayType('', undefined)", ""); | |
| 20 testExpected("video.canPlayType('', 'webkit-org.w3.clearkey')", ""); | |
| 21 testExpected("video.canPlayType('', 'WeBkIt-OrG.W3.ClEaRkEy')", ""); | |
| 22 testExpected("video.canPlayType('', 'com.example.invalid')", ""); | |
| 23 | |
| 24 consoleWrite("<br>Always return the empty string for when no contain
er is specified."); | |
| 25 testExpected("video.canPlayType('video/')", ""); | |
| 26 testExpected("video.canPlayType('video/', '')", ""); | |
| 27 testExpected("video.canPlayType('video/', null)", ""); | |
| 28 testExpected("video.canPlayType('video/', undefined)", ""); | |
| 29 testExpected("video.canPlayType('video/', 'webkit-org.w3.clearkey')"
, ""); | |
| 30 testExpected("video.canPlayType('video/', 'WeBkIt-OrG.W3.ClEaRkEy')"
, ""); | |
| 31 testExpected("video.canPlayType('video/', 'com.example.invalid')", "
"); | |
| 32 | |
| 33 consoleWrite("<br>Always return the empty string for an unsupported
container."); | |
| 34 testExpected("video.canPlayType('video/blahblah')", ""); | |
| 35 testExpected("video.canPlayType('video/blahblah', '')", ""); | |
| 36 testExpected("video.canPlayType('video/blahblah', null)", ""); | |
| 37 testExpected("video.canPlayType('video/blahblah', undefined)", ""); | |
| 38 testExpected("video.canPlayType('video/blahblah', 'webkit-org.w3.cle
arkey')", ""); | |
| 39 testExpected("video.canPlayType('video/blahblah', 'WeBkIt-OrG.W3.ClE
aRkEy')", ""); | |
| 40 testExpected("video.canPlayType('video/blahblah', 'com.example.inval
id')", ""); | |
| 41 | |
| 42 consoleWrite("<br>Empty key system parameters should not affect the
result of video/mp4 types."); | |
| 43 var mp4Result = video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"
'); | |
| 44 var mp4ResultLogString = "Result of video.canPlayType('video/mp4; Co
decs=\"avc1.4D400C\"'): '" + mp4Result + "'"; | |
| 45 consoleWrite(mp4ResultLogString); | |
| 46 testExpected("video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"',
'')", mp4Result); | |
| 47 testExpected("video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"',
null)", mp4Result); | |
| 48 testExpected("video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"',
undefined)", mp4Result); | |
| 49 consoleWrite("There are currently no implementations supporting encr
yption of video/mp4."); | |
| 50 testExpected("video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"',
'webkit-org.w3.clearkey')", ""); | |
| 51 testExpected("video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"',
'WeBkIt-OrG.W3.ClEaRkEy')", ""); | |
| 52 testExpected("video.canPlayType('video/mp4; Codecs=\"avc1.4D400C\"',
'com.example.invalid')", ""); | |
| 53 | |
| 54 consoleWrite("<br>Empty key system parameters should not affect the
result of audio/mpeg types."); | |
| 55 var mpegResult = video.canPlayType('audio/mpeg'); | |
| 56 var mpegResultLogString = "Result of video.canPlayType('audio/mpeg')
: '" + mpegResult + "'"; | |
| 57 consoleWrite(mpegResultLogString); | |
| 58 testExpected("video.canPlayType('audio/mpeg', '')", mpegResult); | |
| 59 testExpected("video.canPlayType('audio/mpeg', null)", mpegResult); | |
| 60 testExpected("video.canPlayType('audio/mpeg', undefined)", mpegResul
t); | |
| 61 consoleWrite("There are currently no implementations supporting encr
yption of audio/mpeg."); | |
| 62 testExpected("video.canPlayType('audio/mpeg', 'webkit-org.w3.clearke
y')", ""); | |
| 63 testExpected("video.canPlayType('audio/mpeg', 'WeBkIt-OrG.W3.ClEaRkE
y')", ""); | |
| 64 testExpected("video.canPlayType('audio/mpeg', 'com.example.invalid')
", ""); | |
| 65 | |
| 66 consoleWrite("<br>Empty key system parameters should not affect the
result of audio/wav types."); | |
| 67 var wavResult = video.canPlayType('audio/wav'); | |
| 68 var wavResultLogString = "Result of video.canPlayType('audio/wav'):
'" + wavResult + "'"; | |
| 69 consoleWrite(wavResultLogString); | |
| 70 testExpected("video.canPlayType('audio/wav', '')", wavResult); | |
| 71 testExpected("video.canPlayType('audio/wav', null)", wavResult); | |
| 72 testExpected("video.canPlayType('audio/wav', undefined)", wavResult)
; | |
| 73 consoleWrite("There are currently no implementations supporting encr
yption of audio/wav."); | |
| 74 testExpected("video.canPlayType('audio/wav', 'webkit-org.w3.clearkey
')", ""); | |
| 75 testExpected("video.canPlayType('audio/wav', 'WeBkIt-OrG.W3.ClEaRkEy
')", ""); | |
| 76 testExpected("video.canPlayType('audio/wav', 'com.example.invalid')"
, ""); | |
| 77 | |
| 78 consoleWrite("<br>Empty key system parameters should not affect the
result of video/webm types."); | |
| 79 var webmResult = video.canPlayType('video/webm'); | |
| 80 var webmResultLogString = "Result of video.canPlayType('video/webm')
: '" + webmResult + "'"; | |
| 81 consoleWrite(webmResultLogString); | |
| 82 testExpected("video.canPlayType('video/webm', '')", webmResult); | |
| 83 testExpected("video.canPlayType('video/webm', null)", webmResult); | |
| 84 testExpected("video.canPlayType('video/webm', undefined)", webmResul
t); | |
| 85 consoleWrite("All implementations that support WebM and Encrypted Me
dia support encrypted WebM."); | |
| 86 testExpected("video.canPlayType('video/webm', 'webkit-org.w3.clearke
y')", webmResult); | |
| 87 testExpected("video.canPlayType('video/webm', 'WeBkIt-OrG.W3.ClEaRkE
y')", webmResult); | |
| 88 testExpected("video.canPlayType('video/webm', 'com.example.invalid')
", ""); | |
| 89 | |
| 90 endTest(); | |
| 91 </script> | |
| 92 </body> | |
| 93 </html> | |
| OLD | NEW |