From 0e761383d43566ccb6a511d1168f1889f78eac3d Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Thu, 8 Mar 2018 17:24:32 -0800 Subject: [PATCH] Tone text --- src/react-components/ui-root.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/react-components/ui-root.js b/src/react-components/ui-root.js index 517267ba8..a75f3c8f8 100644 --- a/src/react-components/ui-root.js +++ b/src/react-components/ui-root.js @@ -75,7 +75,8 @@ class UIRoot extends Component { enterInVR: false, micDevices: [], mediaStream: null, - toneInterval: null + toneInterval: null, + tonePlaying: false } performDirectEntryFlow = async (enterInVR) => { @@ -134,7 +135,13 @@ class UIRoot extends Component { beginAudioSetup = async () => { await this.fetchMicDevices(); - const playTone = () => document.querySelector("#test-tone").play(); + + const playTone = () => { + document.querySelector("#test-tone").play(); + this.setState({ tonePlaying: true }); + setTimeout(() => this.setState({ tonePlaying: false }), 2000); + }; + playTone(); const toneInterval = setInterval(playTone, 5000); this.setState({ toneInterval, entryStep: ENTRY_STEPS.audio_setup }); @@ -204,6 +211,7 @@ class UIRoot extends Component { <select value={selectedMicDeviceId} onChange={this.micDeviceChanged}> { this.state.micDevices.map(d => (<option key={ d.deviceId } value={ d.deviceId }>{d.label}</option>)) } </select> + { this.state.tonePlaying && (<div>Tone</div>) } <button onClick={this.onAudioReadyButton}> Audio Ready </button> -- GitLab