OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <body><span>click me</span></body> | 2 <body><span>click me</span></body> |
3 <script> | 3 <script> |
4 if ('internals' in window) | 4 if ('internals' in window) |
5 window.internals.settings.setMediaPlaybackRequiresUserGesture(true); | 5 window.internals.settings.setAutoplayPolicy('user-gesture-required'); |
6 | 6 |
7 function synthesizeClick(callback) { | 7 function synthesizeClick(callback) { |
8 document.onclick = callback; | 8 document.onclick = callback; |
9 window.parent.postMessage({ msg: 'clickme' }, '*'); | 9 window.parent.postMessage({ msg: 'clickme' }, '*'); |
10 } | 10 } |
11 | 11 |
12 // AudioContext will start as suspended when lacking a user gesture. | 12 // AudioContext will start as suspended when lacking a user gesture. |
13 var audioContext = new AudioContext(); | 13 var audioContext = new AudioContext(); |
14 window.parent.postMessage({ msg: 'initialState', value: audioContext.state }, | 14 window.parent.postMessage({ msg: 'initialState', value: audioContext.state }, |
15 '*'); | 15 '*'); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Creating an AudioContext from a click event will start it. | 59 // Creating an AudioContext from a click event will start it. |
60 var lastAudioContext = new AudioContext(); | 60 var lastAudioContext = new AudioContext(); |
61 window.parent.postMessage({ msg: 'stateCreatedAfterClick', | 61 window.parent.postMessage({ msg: 'stateCreatedAfterClick', |
62 value: lastAudioContext.state }, '*'); | 62 value: lastAudioContext.state }, '*'); |
63 | 63 |
64 window.parent.postMessage({ msg: 'done' }, '*'); | 64 window.parent.postMessage({ msg: 'done' }, '*'); |
65 }); | 65 }); |
66 }); | 66 }); |
67 }); | 67 }); |
68 </script> | 68 </script> |
OLD | NEW |