1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34

content / test / data / android / eme_permissions.html [blame]

<html>
    <script>
        var functionToRun = '';
        function runFunctionOnClick() {
            eval(functionToRun);
        }

        window.addEventListener('load', () => {
            window.addEventListener('click', runFunctionOnClick);
        });

        function requestEME() {
            var capabilities = [{ contentType: 'audio/webm; codecs="opus"' }];
            navigator.requestMediaKeySystemAccess(
                "com.widevine.alpha", [{
                    distinctiveIdentifier: "required",
                    persistentState: "required",
                    audioCapabilities: capabilities,
                    label: "'distinctiveIdentifier' and 'persistentState' required"
                }]
            ).then(
                _ => {
                    document.title = "Granted"; document.body.innerText = "Granted";
                },
                _ => {
                    document.title = "Denied"; document.body.innerText = "Denied";
                }
            );
        }
    </script>
<body>
    This page tests for EME permissions with user gesture
</body>
</html>