electron/spec/fixtures/api/is-currently-audible.html

21 lines
607 B
HTML
Raw Normal View History

<html>
<body>
<div id="video"></div>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = window.top != null ? window.top.require('electron') : require('electron')
ipcRenderer.on('play', (event) => {
const context = new window.AudioContext();
const oscillator = context.createOscillator();
// A beep
oscillator.type = 'sine';
oscillator.frequency.value = 440
oscillator.connect(context.destination)
oscillator.start()
// It'll take a few ms before the beep shows up
setTimeout(() => event.sender.send('playing'), 100)
})
</script>
</body>
</html>