updateSound method

  1. @override
Future<void> updateSound(
  1. SoundName soundName,
  2. String? url
)
override

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

Implementation

@override
Future<void> updateSound(SoundName soundName, String? url) async {
  if (device == null) {
    printDebug("Device is not initialized, cannot update sound");
    return;
  }

  final name = soundName.jsName;

  if(url == null || url.isEmpty) {
    _soundMap.remove(name);
  } else {
    // Use provided url
    _soundMap[name] = url;
  }

  // Update Twilio Device sound
  device!.updateOptions(_deviceOptions);
}