OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <script src="../../resources/js-test.js"></script> |
| 4 <body> |
| 5 <script type="text/javascript"> |
| 6 description("Test EME permission callbacks in WebView"); |
| 7 function eme() { |
| 8 // https://w3c.github.io/encrypted-media/#requestMediaKeySystemAccess |
| 9 // Tries multiple configuration per key system. The configurations are i
n |
| 10 // descending order of privileges such that a supported permission-requi
ring |
| 11 // configuration should be attempted before a configuration that does no
t |
| 12 // require permissions. |
| 13 |
| 14 var knownKeySystems = [ |
| 15 "com.example.somesystem", // Ensure no real system is the first tried
. |
| 16 "com.widevine.alpha", |
| 17 "com.microsoft.playready", |
| 18 "com.adobe.primetime", |
| 19 "com.apple.fps.2_0", |
| 20 "com.apple.fps", |
| 21 "com.apple.fps.1_0", |
| 22 "com.example.somesystem" // Ensure no real system is the last tried. |
| 23 ]; |
| 24 var tryKeySystem = function(keySystem) { |
| 25 navigator.requestMediaKeySystemAccess( |
| 26 keySystem, |
| 27 [ |
| 28 { distinctiveIdentifier: "required", |
| 29 persistentState: "required", |
| 30 label: "'distinctiveIdentifier' and 'persistentState' required" |
| 31 }, |
| 32 { distinctiveIdentifier: "required", |
| 33 label: "'distinctiveIdentifier' required" |
| 34 }, |
| 35 { persistentState: "required", |
| 36 label: "'persistentState' required" |
| 37 }, |
| 38 { label: "empty" } |
| 39 ] |
| 40 ).then( |
| 41 function (mediaKeySystemAccess) { |
| 42 debug("eme success"); |
| 43 finishJSTest(); |
| 44 }, |
| 45 function (error) { |
| 46 if (knownKeySystems.length > 0) |
| 47 return tryKeySystem(knownKeySystems.shift()); |
| 48 testFailed("onError: code" + error.code + ", message=" + error.mes
sage); |
| 49 finishJSTest(); |
| 50 } |
| 51 ); |
| 52 }; |
| 53 tryKeySystem(knownKeySystems.shift()); |
| 54 } |
| 55 eme(); |
| 56 </script> |
| 57 </body> |
| 58 </html> |
OLD | NEW |