alexmercerind / flutter_audio_desktop

[WIP] An 🎵 audio playback library for Flutter Desktop. Supports Windows & Linux. Based on miniaudio.
MIT License
52 stars 18 forks source link

Devices Refactor #14

Closed MichealReed closed 3 years ago

MichealReed commented 3 years ago

This PR refactors devices to allow users to retrieve the names of devices in dart for display in selection menus.

Adds:

// See a list of available system audio devices.
// You can then change the device with setDevice,
// and the ID included in the returned map.
Map<String, dynamic> result = await audioPlayer.getDevices();
// or if you don't need to refresh, access from
// audioPlayer.devices

The system default will automatically be the selected device on init. setDevice can now be used to change devices dynamically. On all AudioPlayers there is a public map devices that is auto-populated on init. Calling getDevices() will refresh this list if new devices are added/deleted from the system.