Error Event - Flutter
This event is helpful for development level troubleshooting while integrating SDK.
Whenever any invalid configuration provided or server/network errors arise, this event will trigger with a specific error code and message.
This event can ease your development process.
We have depicted a specific error name with code and message in the below table.
| Error Name | Code | Message |
|---|---|---|
| INVALID_API_KEY | 4001 | apikey provided in the token is empty or invalid, please verify it on the dashboard. |
| INVALID_TOKEN | 4002 | token is empty or invalid or might have expired. |
| INVALID_ROOM_ID | 4003 | roomId is empty or invalid, please verify it or generate new room ID using the API. |
| INVALID_PARTICIPANT_ID | 4004 | participantId is empty or invalid, it shouldn't contain any whitespaces. |
| DUPLICATE_PARTICIPANT | 4005 | Leaving room, since this participantId joined from another device. |
| ACCOUNT_DEACTIVATED | 4006 | It seems your account is deactivated by VideoSDK for some reason, you can reach out to us at support@videosdk.live. |
| ACCOUNT_DISCONTINUED | 4007 | Server will respond you with specific message. |
| INVALID_PERMISSIONS | 4008 | permissions provided in the token are invalid, please don't use allow_join or allow_mod with ask_join. |
| MAX_PARTCIPANT_REACHED | 4009 | You have reached max participant limit in a room. To increase contact at support@videosdk.live. |
| MAX_SPEAKER_REACHED | 4010 | You have reached max speaker limit in a room. |
| START_RECORDING_FAILED | 4011 | Recording start request failed due to an unknown error. |
| STOP_RECORDING_FAILED | 4012 | Recording stop request failed due to an unknown error. |
| START_LIVESTREAM_FAILED | 4013 | Livestream start request failed due to an unknown error. |
| STOP_LIVESTREAM_FAILED | 4014 | Livestream stop request failed due to an unknown error. |
| INVALID_LIVESTREAM_CONFIG | 4015 | Livestream 'outputs' configuration provided was invalid. |
| START_HLS_FAILED | 4016 | HLS start request failed due to an unknown error. |
| STOP_HLS_FAILED | 4017 | HLS stop request failed due to an unknown error. |
| PREV_RECORDING_PROCESSING | 4018 | Previous recording session is being processed, please try again after few seconds! |
| PREV_RTMP_RECORDING_PROCESSING | 4019 | Previous RTMP recording session is being processed, please try again after few seconds! |
| PREV_HLS_STREAMING_PROCESSING | 4020 | Previous HLS streaming session is being processed, please try again after few seconds! |
| MAX_SPEAKER_LIMIT_REACHED_ON_ORGANIZATION | 4026 | You have reached max speaker limit on organization. To increase contact at support@videosdk.live. |
| MAX_VIEWER_LIMIT_REACHED_ON_ORGANIZATION | 4027 | You have reached max viewer limit on organization. To increase contact at support@videosdk.live. |
| MAX_RECORDING_LIMIT_REACHED_ON_ORGANIZATION | 4028 | You have reached max limit of recording on organization. To increase contact at support@videosdk.live. |
| MAX_HLS_LIMIT_REACHED_ON_ORGANIZATION | 4029 | You have reached max limit of hls on organization. To increase contact at support@videosdk.live. |
| MAX_LIVESTREAM_LIMIT_REACHED_ON_ORGANIZATION | 4030 | You have reached max limit of livestream on organization. To increase contact at support@videosdk.live. |
| RECORDING_FAILED | 5001 | Recording stopped due to an unknown error. |
| LIVESTREAM_FAILED | 5002 | Livestream stopped due to an unknown error. |
| HLS_FAILED | 5003 | HLS stopped due to an unknown error. |
| RECORDING_DURATION_LIMIT_REACHED | 5004 | Recording has been automatically stopped by the system, due to max duration limit of 2 hours reached for a single Recording |
| LIVESTREAM_DURATION_LIMIT_REACHED | 5005 | Livestream has been automatically stopped by the system, due to max duration limit of 2 hours reached for a single RTMP |
| HLS_DURATION_LIMIT_REACHED | 5006 | Hls has been automatically stopped by the system, due to max duration limit of 2 hours reached for a single HLS |
| ERROR_CAMERA_ACCESS_DENIED_OR_DISMISSED | 3017 | Oops! It seems like camera access was denied or dismissed. To proceed, kindly grant access through your browser settings. |
| ERROR_MICROPHONE_ACCESS_DENIED_OR_DISMISSED | 3018 | Oops! It seems like microphone access was denied or dismissed. To proceed, kindly grant access through your browser settings. |
| ERROR_ROOM_RECONNECTING | 3065 | The room is reconnecting. Please try again once it reconnects. |
MAX_PARTCIPANT_REACHED is the name the SDK uses for code 4009, so compare this error by its code. For every code, see Room Error Codes.
Event Code
Every error carries a code (an int), a name and a message. Branch on the code, not on the message, which the server can replace with its own.
Every catalogue error is also a constant on VideoSDKError, such as VideoSDKError.ERROR_ROOM_RECONNECTING. Errors are equal when their code is equal, so you can compare with ==:
try {
await room.enableCam();
} on VideoSDKError catch (error) {
if (error == VideoSDKError.ERROR_ROOM_RECONNECTING) {
// try again once the room reconnects
}
}
Listen for the event on the room. The handler receives a VideoSDKError.
//add listener for the error events.
_room.on(Events.error, (VideoSDKError error) {
log("VIDEOSDK ERROR :: ${error.code} :: ${error.name} :: ${error.message}");
});
Methods such as join() return a Future that throws a VideoSDKError with the same code, name and message when they fail. Some failures reach both your catch and Events.error, so handle each error in one place. On Android, most actions called while the room reconnects report 3065 on Events.error and return without throwing, so keep an Events.error handler too.
try {
await _room.join();
} on VideoSDKError catch (error) {
log("VIDEOSDK ERROR :: ${error.code} :: ${error.name} :: ${error.message}");
}
Got a Question? Ask us on discord

