handleViewMethodCall method
Implementation
Future<dynamic> handleViewMethodCall(MethodCall call, Element element) async {
var data = <String, dynamic>{};
if (call.arguments != null) {
data = Map<String, dynamic>.from(call.arguments);
}
if (call.method == 'setData') {
final uid = data['userId'];
if (uid == 0) {
const kEngineSetupLocalVideo = 20;
return promiseToFuture(_engine(data).callApi(
kEngineSetupLocalVideo,
jsonEncode({
'canvas': {
'uid': 0,
'channelId': data['channelId'],
'renderMode': data['renderMode'],
'mirrorMode': data['mirrorMode'],
},
}),
element));
} else {
const kEngineSetupRemoteVideo = 21;
return promiseToFuture(_engine(data).callApi(
kEngineSetupRemoteVideo,
jsonEncode({
'canvas': {
'uid': uid,
'channelId': data['channelId'],
'renderMode': data['renderMode'],
'mirrorMode': data['mirrorMode'],
}
}),
element));
}
} else {
throw PlatformException(
code: 'Unimplemented',
details:
'agora_rtc_engine for web doesn\'t implement \'${call.method}\'',
);
}
}