When I enter the page with the camera and microphone turned off, when I open the camera, the camera opens, then when I try to open the microphone, the microphone is not transmitted.In Transport.on("produce") data['callback'](serverProducerId);triggering once for camera triggering once for audio.On 2nd trigger I get error as below
flutter: Bad state: Future already completed
flutter:
#0 _AsyncCompleter.complete (dart:async/future_impl.dart:35:31)
#1 VideoConferencingViewModel.registerMediaServerEvents.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:ecampus/view/home/video_conferencing/view_model/video_conferencing_view_model.dart:1002:29)
#2 HubConnection._invokeClientMethod.<anonymous closure> (package:signalr_netcore/hub_connection.dart:685:31)
#3 List.forEach (dart:core-patch/growable_array.dart:416:8)
#4 HubConnection._invokeClientMethod (package:signalr_netcore/hub_connection.dart:685:15)
#5 HubConnection._processIncomingData (package:signalr_netcore/hub_connection.dart:560:13)
#6 WebSocketTransport.connect.<anonymous closure> (package:signalr_netcore/web_socket_transport.dart:68:23)
#7 _rootRunUnary (dart:async/zone.dart:1407:47)
Inside of my Transport.on("produce") code
producerTransport!.on("produce", (Map data) async {
Map clonedMap = {};
clonedMap["kind"] = data["kind"];
clonedMap["rtpParameters"] = data["rtpParameters"].toMap();
if (data['appData'] != null) {
clonedMap["appData"] = data["appData"];
}
try {
meetingHubConn.invoke("StartProduce", args: [
clonedMap,
meetingRtcState.muteCamera.value,
meetingRtcState.muteAudio.value
]);
meetingHubConn!.on("ServerProduce", (args) async {
var serverProducerId = (args as List)[0] as String;
data['callback'](serverProducerId);
});
} catch (error) {
print(error);
data['errback']();
}
});
Can you help me?
I can't solve the problem.