findOriginalProducerForSpeaker function
Find the original producer ID for a speaker from all audio streams. This is needed when we receive a translation producer and need to pause the original.
Implementation
String? findOriginalProducerForSpeaker(
String speakerId,
List<Map<String, dynamic>> allAudioStreams,
) {
final stream = allAudioStreams.firstWhere(
(s) =>
s['name'] == speakerId ||
(s['producerId'] as String?)?.contains(speakerId) == true,
orElse: () => <String, dynamic>{},
);
return stream['producerId'] as String?;
}