function stateChangeHandler(connectionState, message) { switch (connectionState) { case HighFidelityAudio.HiFiConnectionStates.Connected: console.log(`Connected successfully!`); break; case HighFidelityAudio.HiFiConnectionStates.Failed: console.error(`Connection failed!`); console.error(message); break; default: console.log(`State changed to ${connectionState}`); break; } } let hifiCommunicator = new HighFidelityAudio.HiFiCommunicator({ onConnectionStateChanged: stateChangeHandler });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter