When the audio player attempts to play a sound on a client with no audio output device, Ignition throws this error:
Details: java.lang.IllegalArgumentException: No line matching interface Clip supporting format PCM_SIGNED 22050.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian, and buffers of 80764 to 80764 bytes is supported...
What would be a good way to check whether an output device is available ahead of time to disable sound playback and avoid this error message?
Thanks @JordanCClark, your code works as expected on a device without audio (as well as on devices with it). My initial post was incorrect in that the error is generated when the sound player component loadssoundData–not when it tries to play it. A binding like the one below on ‘soundData’ avoids the error. A function like yours sets the client tag in a client startup script and sound bytes are stored in a tag.
// Clear sound data on clients with no sound output device to avoid errors.
if(!{[Client]isSoundOutputDeviceAvailable}, None, {Ignition/sounds}[3,1])
It’s been a while, but I believe I used the browse button on soundData property of the sound player component to load a sound into it and then copied the soundData string that showed up in that property to the dataset.