setOutputDevice
Description​
Changes the output device which should be used for playing the audio (player must be enabled). Use enumerateOutputDevices to load the list of available devices.
In the web version this functionality relies on experimental APIs and might not yet be available in all browsers. https://caniuse.com/mdn-api_audiocontext_sinkid
- JavaScript
- C#
- Kotlin
setOutputDevice(device: ISynthOutputDevice | null): Promise<void>System.Threading.Task<void> SetOutputDevice(ISynthOutputDevice? device)suspend fun setOutputDevice(device: ISynthOutputDevice?): Unit| Parameter | Summary |
|---|---|
deviceAll | The output device to use, or null to switch to the default device. |
Examples​
- JavaScript
- C#
- Android
const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
const devices = await api.enumerateOutputDevices();
buildDeviceSelector(devices, async selectedDevice => {
await api.setOutputDevice(selectedDevice);
});
var api = new AlphaTabApi<MyControl>(...);
var devices = await api.EnumerateOutputDevices();
BuildDeviceSelector(devices, async selectedDevice => {
await api.SetOutputDevice(selectedDevice);
});
fun init() = kotlinx.coroutines.runBlocking {
val api = AlphaTabApi<MyControl>(...)
val devices = api.enumerateOutputDevices().await()
buildDeviceSelector(devices, fun (selectedDevice) {
suspend {
await api.setOutputDevice(selectedDevice)
}
});
}