enumerateOutputDevices
Description​
Loads and lists the available output devices which can be used by the player. Will request permissions if needed.
The values provided, can be passed into setOutputDevice
to change dynamically the output device on which
the sound is played.
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
enumerateOutputDevices(): Promise<ISynthOutputDevice[]>
System.Threading.Task<IList<ISynthOutputDevice>> EnumerateOutputDevices()
suspend fun enumerateOutputDevices(): alphaTab.collections.List<ISynthOutputDevice>
Returns​
the list of available devices or an empty list if there are no permissions, or the player is not enabled.
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)
}
});
}