Menu

Web

Last updated: 2023-10-13 11:23:34Download PDF

1. Basics



What browsers does the TRTC web SDK support?

For details about browser support, please see Browsers Supported. If your browser is not listed in the above document, you can open the TRTC compatibility check page with the browser to test whether it fully supports WebRTC.


How do I test my audio/video devices before making a call?



How do I test my current network quality?



I can use the TRTC web SDK in a local development environment but not after it is deployed online. What should I do?

To ensure data security and protect users’ privacy, browsers allow access to the mic and camera only in secure environments, for example, when https, localhost, or file:// is used for access. Because HTTP is not secure, browsers block access to media devices when HTTP is used.
If you can use the SDK in a local development environment but cannot capture data from the camera or mic after deploying it to the web, check whether your webpage is deployed using HTTP. If so, use HTTPS instead and make sure you have a valid HTTPS certificate.
For more information, see Domain Name and Protocol Support.


Does the web SDK support the dual-stream mode, watermarking?

You can refer to Enable Dual-Channel Mode, and Enable Watermarking to enable the advanced features.

What are the known issues of WebRTC?

2. Publishing and Playing



What do the errors NotFoundError, NotAllowedError, NotReadableError, OverConstrainedError, and AbortError found in the log of the TRTC web SDK mean?

Error
Description
Suggested Solution
NotFoundError
The media (audio, video, or screen sharing) specified by the request parameter are not found. This error occurs if, for example, the PC has no cameras but the browser is asked to obtain a video stream.
Remind users to check devices such as cameras and mics before making a call. If a user does not have a camera and wants to make an audio call, use TRTC.createStream({ audio: true, video: false}) to make the SDK capture audio only.
NotAllowedError
The user has rejected the request of the current browser instance to access the camera/mic or share screens.
Remind the user that audio/video calls are not possible without camera/mic access.
NotReadableError
The user has granted access to the requested device, but it is still inaccessible due to a hardware, browser, or webpage error.
Handle the error according to the error message returned, and send this message to the user: “The camera/mic cannot be accessed. Please make sure that no other applications are requesting access and try again.”
OverConstrainedError
The cameraId/microphoneId value is invalid.
Make sure that a valid cameraId/microphoneId value is passed in.
AbortError
The device cannot be accessed due to an unknown reason.
-
For more information, seedevice_error.


Why am I unable to publish or play streams on some mobile browsers?

For details about browser support, see Browsers Supported. If your browser is not listed in the above document, you can open the TRTC compatibility check page with the browser to test whether it fully supports WebRTC.


In the TRTC web SDK, are resolution settings for stream publishing applicable to all browsers?

The resolution set may be unattainable due to device and browser restrictions, in which case the browser will adjust the resolution to make it as close as possible to the target. For details, see setVideoProfile.


Can I modify the style of screen sharing in the TRTC web SDK?

No. The style of screen sharing is controlled by browsers and cannot be modified.


Does the TRTC web SDK support stream mixing?

Yes, it does. For details, see startMixTranscode.


In the TRTC web SDK, how do I remove a camera from the camera list after it is disconnected?

You can call TRTC.getCameraListto see if you can get the new device list. If there is still information of the disconnected camera, it indicates that the browser has not refreshed the list and the SDK cannot get the new device list.


Why am I unable to publish streams from WeChat’s built-in browser on iOS?

To learn whether the built-in browser of WeChat for iOS supports publishing or playback, please see Browsers Supported.

3. Playing



Why is there video but no audio during a call?

It may be because of the browser’s autoplay policy, which causes the “PLAY_NOT_ALLOWED” error. To solve the problem, display a window on the UI and, in the callback for the window’s clicking event, call Stream.resume() to resume audio playback. For details, please see Suggested Solutions for Autoplay Restrictions.
This problem may also be caused by an unknown error. Check the audioLevel and audioEnergy of the sender and recipient in the dashboard.


What should I do if video is not displayed during a call?

Check whether the webpage has obtained any data. If data can be sent and received successfully, check whether the correct mediaStream object is assigned to the srcObject property of <video>. Video will not be displayed if srcObject is incorrect.


What should I do if there is echo or noise during a call or the volume of a call is small?

These issues are common if the call participants are close to each other. Please ensure a certain distance between call participants when testing. If a non-web client hears echo or noise from a web client, it indicates that 3A is not working on the web end. If you use the browser’s built-in API getUserMedia for custom capturing, you need to enable 3A manually using the parameters below:
echoCancellation: echo cancellation
noiseSuppression: noise suppression
autoGainControl: automatic gain control. For detailed directions, see MediaTrackConstraints.

4. Others

Does the TRTC web SDK support getting the current volume?

You can use enableAudioVolumeEvaluation to get the current volume. For details, please see Detecting Volume.


What triggers the trtc.on(TRTC.EVENT.KICKED_OUT) event?

The event is triggered when a user is removed from a room, for example, when the same user ID is used to log in from different devices or when the RESTful API RemoveUser is called to remove a user. For more information, see KICKED_OUT
notice
Repeated login is not allowed by the SDK (it may cause call exceptions) and should be avoided at the business layer.

How do I capture system audio during screen sharing in the TRTC web SDK?

See Capturing System Audio During Screen Sharing. Currently, system audio capturing is supported on Chrome M74+ only. On Chrome for Windows and Chrome OS, you can capture the audio of the entire system, while on Chrome for Linux and macOS, you can capture only the audio of Chrome tabs. Other Chrome versions, OS, and browsers do not support system audio capturing.


How do I switch the camera/mic in the TRTC web SDK?

You can first get the system’s cameras and mics and call updateLocalVideo to switch the camera/mic. For detailed directions, please see Switching Cameras/Mics.


What should I do if the error "Permission denied" occurs when I use the TRTC web SDK in iframes?

To use WebRTC in iframes, you need to add the following attribute to the iframe tag to obtain the permissions needed. Mic, camera, and screen sharing permissions:
<iframe allow="microphone; camera; display-capture;">