OmicallSDKController constructor
OmicallSDKController()
Implementation
OmicallSDKController() {
_methodChannel.setMethodCallHandler((call) async {
final method = call.method;
final data = call.arguments;
debugPrint("method OmicallSDKController:: ${method}");
if (method == OmiEventList.onMuted) {
if (muteListener != null) {
muteListener!(data);
}
return;
}
if (method == OmiEventList.onSpeaker) {
if (speakerListener != null) {
speakerListener!(data);
}
return;
}
if (method == OmiEventList.onRemoteVideoReady) {
final param = {
"name": method,
"data": data,
};
if (videoListener != null) {
videoListener!(param);
}
return;
}
if (method == OmiEventList.onMissedCall) {
if (missedCallListener != null) {
missedCallListener!(data);
}
return;
}
if (method == OmiEventList.onCallQuality) {
if (callQualityListener != null) {
callQualityListener!.call(data);
}
return;
}
if (method == OmiEventList.onHistoryCallLog) {
if (callLogListener != null) {
callLogListener!.call(data);
}
return;
}
if (method == OmiEventList.onAudioChanged) {
if (audioChangedListener != null) {
var correctData = data["data"];
if ((correctData is List) == false) {
correctData = [correctData];
}
audioChangedListener!.call(correctData);
}
return;
}
_callStateChangeController.sink.add(
OmiAction(
actionName: call.method,
data: data ?? <dynamic, dynamic>{},
),
);
});
}