electron/spec/fixtures/api/is-currently-audible.html
Felix Rieseberg deedf6c3f4 feat: Add isCurrentlyAudible() to WebContents (#13614)
* 🔧 Add isCurrentlyAudible() to WebContents

* ❤️ Implement feedback, use await to wait for event

* 👷 Add missing imports
2018-07-12 21:35:11 +10:00

21 lines
No EOL
607 B
HTML

<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>