updateSounds method

  1. @override
Future<void> updateSounds({
  1. Map<SoundName, String>? sounds,
})
override

Update Twilio Device sounds defined by SoundName, this will override the default Twilio Javascript sounds. If a corresponding null value is provided, the default will be used. Documentation: https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#deviceoptionssounds-properties-and-default-sounds

Implementation

@override
Future<void> updateSounds({Map<SoundName, String>? sounds}) async {
  if(device == null) {
    printDebug("Device is not initialized, cannot update sounds");
    return;
  }
  if (sounds == null || sounds.isEmpty) {
    return;
  }

  _soundMap.clear();
  _soundMap.addAll(sounds.map((k, v) => MapEntry(k.jsName, v)));

  device!.updateOptions(_deviceOptions);
}