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