handleJavaScriptUpdate method
Implementation
void handleJavaScriptUpdate(JavaScriptUpdate update) {
print("jsonData ${update.data}");
dynamic dartMap = jsonDecode(update.data);
Map<String, dynamic> data = {};
if (dartMap is List<dynamic>) {
List<Map<String, dynamic>> listOfMaps = [];
for (var item in dartMap) {
if (item is Map<String, dynamic>) {
listOfMaps.add(item);
}
}
data['activeList'] = listOfMaps;
// data.addEntries({"activeList":listOfMaps}.entries);
} else {
data = dartMap;
}
print(
'Received update from JavaScript - Method: ${update.methodName}, Data: ${update.data}');
switch (update.methodName) {
case 'room-connected':
// print('Method room-connected ${update.data.toString()}');
data.addEntries({"event": "onRoomConnected"}.entries);
data.update("userList", (value) => data['userList'].values.toList());
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-error':
print('room-error ${update.data.toString()}');
data.addEntries({"event": "onRoomError"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-allowed':
print('room-allowed ${update.data.toString()}');
break;
case 'user-connected':
print('user-connected ${update.data.toString()}');
data.addEntries({"event": "onUserConnected"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-awaited':
print('user-awaited ${update.data.toString()}');
break;
case 'active-talkers-updated':
data.addEntries({"event": "onActiveTalkerList"}.entries);
EnxRtc.receiveDataFromWeb(data);
print('active-talkers-updated ${update.data.toString()}');
break;
case 'onAudioEvent':
data.addEntries({"event": "onAudioEvent"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-audio-muted':
data.addEntries({"event": "onRemoteStreamAudioMute"}.entries);
EnxRtc.receiveDataFromWeb(data);
data.addEntries({"event": "onReceivedHardMuteAudio"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-audio-unmuted':
print('user-audio-unmuted ${update.data.toString()}');
data.addEntries({"event": "onRemoteStreamAudioUnMute"}.entries);
EnxRtc.receiveDataFromWeb(data);
data.addEntries({"event": "onReceivedHardUnMuteAudio"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onVideoEvent':
print('user-video-muted ${update.data.toString()}');
data.addEntries({"event": "onVideoEvent"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-video-muted':
print('user-video-muted ${update.data.toString()}');
data.addEntries({"event": "onRemoteStreamVideoMute"}.entries);
EnxRtc.receiveDataFromWeb(data);
data.addEntries({"event": "onReceivedHardMuteVideo"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-video-unmuted':
data.addEntries({"event": "onRemoteStreamVideoUnMute"}.entries);
EnxRtc.receiveDataFromWeb(data);
data.addEntries({"event": "onReceivedHardUnMuteVideo"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onHardMuted':
data.addEntries({"event": "onHardMuted"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onHardUnMuted':
data.addEntries({"event": "onHardUnMuted"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hard-mute-room':
data.addEntries({"event": "onReceivedHardMute"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hard-unmute-room':
data.addEntries({"event": "onReceivedHardUnMute"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hardmute-user-audio':
data.addEntries({"event": "onAckHardMuteUserAudio"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hardunmute-user-audio ':
data.addEntries({"event": "onAckHardunMuteUserAudio"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hardmute-user-video':
data.addEntries({"event": "onAckHardMuteUserVideo"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hardunmute-user-video':
data.addEntries({"event": "onAckHardUnMuteUserVideo"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-disconnected':
print('room-disconnected ${update.data.toString()}');
data.addEntries({"event": "onRoomDisConnected"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-disconnected':
print('user-disconnected ${update.data.toString()}');
data.addEntries({"event": "onUserDisConnected"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'removeView':
removeView(data['id']);
break;
case 'getDevices':
data.addEntries({"event": "getDevices"}.entries);
EnxRtc.receiveDataFromWeb(data);
case 'stream-added':
data.addEntries({"event": "onStreamAdded"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'stream-subscribed':
data.addEntries({"event": "onSubscribedStream"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-locked':
data.addEntries({"event": "onLockedRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-unlocked':
data.addEntries({"event": "onUnLockedRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'conference-remaining-duration':
data.addEntries({"event": "onConferenceRemainingDuration"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onConferencessExtended':
data.addEntries({"event": "onConferencessExtended"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onSetTalkerCount':
data.addEntries({"event": "onSetTalkerCount"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onGetTalkerCount':
data.addEntries({"event": "onGetTalkerCount"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onMaxTalkerCount':
data.addEntries({"event": "onMaxTalkerCount"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-record-on':
data.addEntries({"event": "onRoomRecordingOn"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-record-off':
data.addEntries({"event": "onRoomRecordingOff"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onStartRecordingEvent':
data.addEntries({"event": "onStartRecordingEvent"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onStopRecordingEvent':
data.addEntries({"event": "onStopRecordingEvent"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckForApproveAwaitedUser':
data.addEntries({"event": "onAckForApproveAwaitedUser"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckForDenyAwaitedUser':
data.addEntries({"event": "onAckForDenyAwaitedUser"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-role-changed':
data.addEntries({"event": "onUserRoleChanged"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onSwitchedUserRole':
data.addEntries({"event": "onSwitchedUserRole"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckPinUsers':
data.addEntries({"event": "onAckPinUsers"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckUnpinUsers':
data.addEntries({"event": "onAckUnpinUsers"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'updated-pinned-users':
data.addEntries({"event": "onPinnedUsers"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckAddSpotlightUsers':
data.addEntries({"event": "onAckAddSpotlightUsers"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckRemoveSpotlightUsers':
data.addEntries({"event": "onAckRemoveSpotlightUsers"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'spotlight-users':
data.addEntries({"event": "onUpdateSpotlightUsers"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckSwitchedRoom':
data.addEntries({"event": "onAckSwitchedRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-mode-switched':
data.addEntries({"event": "onRoomModeSwitched"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'message-received':
data.addEntries({"event": "onMessageReceived"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-data-received':
data.addEntries({"event": "onUserDataReceived"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAcknowledgedSendData':
data.addEntries({"event": "onAcknowledgedSendData"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'share-started':
data.addEntries({"event": "onScreenSharedStarted"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'share-stopped':
data.addEntries({"event": "onScreenSharedStopped"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onStartScreenShareACK':
data.addEntries({"event": "onStartScreenShareACK"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onStoppedScreenShareACK':
data.addEntries({"event": "onStoppedScreenShareACK"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'canvas-started':
data.addEntries({"event": "onAnnotationStarted"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'canvas-stopped':
data.addEntries({"event": "onAnnotationStopped"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onStartAnnotationAck':
data.addEntries({"event": "onStartAnnotationAck"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onStoppedAnnotationAck':
data.addEntries({"event": "onStoppedAnnotationAck"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckStartStreaming':
data.addEntries({"event": "onAckStartStreaming"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckStopStreaming':
data.addEntries({"event": "onAckStopStreaming"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'streaming-started':
data.addEntries({"event": "onStreamingStarted"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'streaming-stopped':
data.addEntries({"event": "onStreamingStopped"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'streaming-failed':
data.addEntries({"event": "onStreamingFailed"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'streaming-updated':
data.addEntries({"event": "onStreamingUpdated"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onACKStartLiveRecording':
data.addEntries({"event": "onACKStartLiveRecording"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onACKStopLiveRecording':
data.addEntries({"event": "onACKStopLiveRecording"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-live-recording-on':
data.addEntries({"event": "onRoomLiveRecordingOn"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-live-recording-failed':
data.addEntries({"event": "onRoomLiveRecordingFailed"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-live-recording-updated':
data.addEntries({"event": "onRoomLiveRecordingUpdate"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-live-recording-off':
data.addEntries({"event": "onRoomLiveRecordingOff"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onACKStartLiveTranscription':
data.addEntries({"event": "onACKStartLiveTranscription"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onACKStopLiveTranscription':
data.addEntries({"event": "onACKStopLiveTranscription"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'self-transcription-on':
data.addEntries({"event": "onSelfTranscriptionOn"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-transcription-on':
data.addEntries({"event": "onRoomTranscriptionOn"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'transcription-events':
data.addEntries({"event": "onTranscriptionEvents"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'self-transcription-off':
data.addEntries({"event": "onSelfTranscriptionOff"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'room-transcription-off':
data.addEntries({"event": "onRoomTranscriptionOff"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hls_started':
data.addEntries({"event": "onHlsStarted"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hls_stopped':
data.addEntries({"event": "onHlsStopped"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hls_failed':
data.addEntries({"event": "onHlsFailed"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'hls_waiting':
data.addEntries({"event": "onHlsWaiting"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckSubscribeTalkerNotification':
data.addEntries({"event": "onAckSubscribeTalkerNotification"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckUnsubscribeTalkerNotification':
data.addEntries(
{"event": "onAckUnsubscribeTalkerNotification"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'talker-notification':
data.addEntries({"event": "onTalkerNotification"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onOutBoundCallInitiated':
data.addEntries({"event": "onOutBoundCallInitiated"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'dial-state-events':
data.addEntries({"event": "onDialStateEvents"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onOutBoundCallCancel':
data.addEntries({"event": "onOutBoundCallCancel"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onOutBoundCallSendDtmf':
data.addEntries({"event": "onOutBoundCallSendDtmf"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onProcessFloorRequested':
data.addEntries({"event": "onProcessFloorRequested"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onFloorRequested':
data.addEntries({"event": "onFloorRequested"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onFloorCancelled':
data.addEntries({"event": "onFloorCancelled"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onFloorFinished':
data.addEntries({"event": "onFloorFinished"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onACKInviteToFloorRequested':
data.addEntries({"event": "onACKInviteToFloorRequested"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-requested':
data.addEntries({"event": "onFloorRequestReceived"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-cancelled':
data.addEntries({"event": "onCancelledFloorRequest"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-denied':
data.addEntries({"event": "onDeniedFloorRequest"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-granted':
data.addEntries({"event": "onGrantedFloor"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-finished':
data.addEntries({"event": "onFinishedFloorRequest"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'release-floor':
data.addEntries({"event": "onReleasedFloorRequest"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-invited':
data.addEntries({"event": "onInviteToFloorRequested"}.entries);
EnxRtc.receiveDataFromWeb(data);
data.addEntries({"event": "onInvitedForFloorAccess"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-invite-cancelled':
data.addEntries({"event": "onCanceledFloorInvite"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-accepted':
data.addEntries({"event": "onAcceptedFloorInvite"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'floor-rejected':
data.addEntries({"event": "onRejectedInviteFloor"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckCreateBreakOutRoom':
data.addEntries({"event": "onAckCreateBreakOutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckCreateAndInviteBreakOutRoom':
data.addEntries({"event": "onAckCreateAndInviteBreakOutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckInviteBreakOutRoom':
data.addEntries({"event": "onAckInviteBreakOutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckPause':
data.addEntries({"event": "onAckPause"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckResume':
data.addEntries({"event": "onAckResume"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckMuteRoom':
data.addEntries({"event": "onAckMuteRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckUnmuteRoom':
data.addEntries({"event": "onAckUnmuteRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'onAckRejectBreakOutRoom':
data.addEntries({"event": "onAckRejectBreakOutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'join-breakout-room':
data.addEntries({"event": "onUserJoinedBreakoutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'breakout-room-joining':
data.addEntries({"event": "onBreakoutroomjoining"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'breakout-room-connected':
data.addEntries({"event": "onConnectedBreakoutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'breakout-room-error':
data.addEntries({"event": "onFailedJoinBreakOutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-joined-breakout-room':
data.addEntries({"event": "onUserJoinedBreakoutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'breakout-invite-rejected':
data.addEntries({"event": "onBreakoutRoomInviteRejected"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'breakout-room-disconnected':
data.addEntries({"event": "onDisconnectedBreakoutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'user-disconnected-breakout-room':
data.addEntries(
{"event": "onUserDisconnectedFromBreakoutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'breakout-user-disconnected':
data.addEntries({"event": "onDisconnectedBreakoutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'breakout-room-destroyed':
data.addEntries({"event": "onDisconnectedBreakoutRoom"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
case 'OnCapturedView':
data.addEntries({"event": "OnCapturedView"}.entries);
EnxRtc.receiveDataFromWeb(data);
break;
}
}