Error Handling

When you make an API call to access an HMS SDK, the SDK may return error codes. ErrorCodes are usually returned when a problem that cannot be recovered without app intervention has occurred.

These are returned as type='error' through the notifications interface. The type of notification.data is HMSException. Find the HMSException interface here.

Handling Autoplay Error

Device Change Settings

Most browsers have a restriction on audio autoplay where audio is allowed only if the user has interacted with the page. You can read more about the restrictions here for chrome and safari.

Sample UI for handling autoplay code code

If an autoplay error is received(code=3008), UI can show a popup or a notification with button. Once a user click has happened confirming an interaction point, unblockAudio can be called.

await hmsActions.unblockAudio();

Error Codes

Following are the different error codes that are returned by the SDK. Before returning any error code, SDK retries the errors wherever possible.

Error CodeCause of the errorAction to be taken
1000Failed to connect to Websocket - Happens due to network issues or firewall blocking Websocket connectionsMention user to check their network connection and firewall/anti-virus/VPN or try again after some time.
1003Websocket disconnected - Happens due to network issuesMention user to check their network connection or try again after some time.
2002Invalid Endpoint URLCheck the endpoint provided while calling join on HMSSDK.
2003Endpoint is not reachableMention user to check their network connection or try again after some time.
2004Token is not in proper JWT formatThe token passed while calling join is not in correct format. Retry getting a new token.
3000Overconstrained errorNo Action needed from end user, we will be internally retrying.
3001User denied permission to access capture device at browser levelAsk user to check permission granted to audio/video capture devices in browser(in address bar).
3002Capture Device is not AvailableAsk user to check if the audio/video capture device is connected or not.
3003Capture device is in use by some other applicationShow notification to user mentioning that the capturing device is used by some other application currently.
3004Lost access to capture device midwaySuggest the user to check connection to their hardware device and try reconnecting.
3005There is no media to return. Please select either video or audio or both.There is no media to return. Please select either video or audio or both.
3006Cannot enable simulcast when no video settings are providedConfigure video track settings to enable simulcast
3008Browser has throw an autoplay exceptionShow notification to user mentioning that the browser blocked autoplay
3009Device unable to satisfy requested media constraintsReduce media constraints for the role in dashboard or upgrade device hardware.
3010No audio detected from track, indicates problem with device hardwareNotify user to try using a headphone for microphone.
3011System denied permission to access capture deviceAsk user to check permission granted to audio/video/screen capture devices in system settings.
3012Current tab is not shared when forceCurrentTab was set to true for screenshare-
3013An error occurred while playing audio of remote audio tracks-
3014Selected audio/video device not detected on changeAsk user to check if the audio/video capture device is connected or not.
3015No data published by the audio/video trackAsk user to check if another app is already using the mic or camera and retry after terminating the app
4001Failed to create offerAsk the user to retry joining
4002Failed to create answerAsk the user to retry joining
4003Failed to set offerAsk the user to retry joining
4004Failed to set answerAsk the user to retry joining
4005ICE Connection Failed due to network issueMention user to check their network connection or try again after some time.
4006ICE Connection Disconnected due to network issueMention user to check their network connection or try again after some time.
5001Trying to join a room which is already joinedTrying to join an already joined room.
5002Trying to join a room when preview is in progressCall join action only when room state is "Preview" and not "Connecting".
6000Calling actions when not connected/joined to a roomCall the required action after joining a room.
6002WebRTC Error: Error while renegotiatingWe can add check error.message for more info.
6003WebRTC engine is not ready yetWait for preview to complete before calling join.
6008Invalid arguments(peer ID, track ID, or others) passed to actionsCheck if the corresponding arguments are valid by checking the store when calling the action
6009Trying to join a room when preview is in progressCall join action only when room state is "Preview" and not "Connecting".
6010navigator.mediaDevices is undefined in insecure contexts served over HTTP protocolDeploy the app in a secure context with HTTPS protocol.
6011RTCPeerConnection is undefined in browserSwitch/Upgrade browser to WebRTC compatible version/check for browser extension blocking WebRTC.
6012The application does not have access to localStorageTry joining the link in a normal browser window if using in incognito mode causes this error. Alternatively, allowing cookies and localStorage via browser settings also works in incognito mode
7001Platform Not SupportedThe platform is not supported for plugin
7002Plugin Init FailedPlugin initialization has failed
7003Plugin Processing FailedPlugin processing failed
7004Plugin Add Already Going onPlugin add is already in progress
8001Playlist: Invalid action callCheck current playing entry, next entry, previous entry when calling seek/seekTo, playNext, playPrevious.

Have a suggestion? Recommend changes ->

Was this helpful?

1234