Menu

Overview

Last updated: 2023-10-09 11:52:00Download PDF

API Details

TRTC

1. TRTC is the main entry for TRTC SDK, providing APIs such as create trtc instance(TRTC.create), TRTC.getCameraList, TRTC.getMicrophoneList, TRTC.isSupported.
2. trtc instance, provides the core capability for real-time audio and video calls.
Enter room trtc.enterRoom
Exit room trtc.exitRoom
Turn on camera trtc.startLocalVideo
Turn on microphone trtc.startLocalAudio
Turn off camera trtc.stopLocalVideo
Turn off microphone trtc.stopLocalAudio
Play remote video trtc.startRemoteVideo
Stop playing remote video trtc.stopRemoteVideo
Mute/unmute remote audio trtc.muteRemoteAudio

TRTC Static Function

Name
Description
create
Create a TRTC object for implementing functions such as entering a room, previewing, pushing, and pulling streams.
Set the log output level It is recommended to set the DEBUG level during development and testing, which includes detailed prompt information. The default output level is INFO, which includes the log information of the main functions of the SDK.
Check if the TRTC Web SDK is supported by the current browser
Returns the list of camera devices Note
Returns the list of microphone devices Note
Returns the list of speaker devices For security reasons, the label and deviceId fields may be empty before the user authorizes access to the camera or microphone. Therefore, it is recommended to call this interface to obtain device details after the user authorizes access.
Set the current speaker for audio playback

TRTC Object Function

Name
Description
enterRoom
Enter a video call room.
exitRoom
Exit the current audio and video call room.
Switches the user role, only effective in TRTC.TYPE.SCENE_LIVE interactive live streaming mode.
destroy
Destroy the TRTC instance
Start collecting audio from the local microphone and publish it to the current room.
Update the configuration of the local microphone.
Stop collecting and publishing the local microphone.
Start collecting video from the local camera, play the camera's video on the specified HTMLElement tag, and publish the camera's video to the current room.
Update the local camera configuration.
Stop capturing, previewing, and publishing the local camera.
Start screen sharing.
Update screen sharing configuration
Stop screen sharing.
Play remote video
Update remote video playback configuration
Used to stop remote video playback.
Mute a remote user and stop pulling audio data from that user. Only effective for the current user, other users in the room can still hear the muted user's voice.
Used to control the playback volume of remote audio.
Enables or disables the volume callback.
on
Listen to TRTC events, For a detailed list of events, please refer to: TRTC.EVENT
off
Remove event listener
Get video track
Get audio track

Tutorials

You can refer to the following tutorials to realize various different functions.
Feature
Sample Code
Audio/Video Call
Tutorial
Interactive Live Streaming
Tutorial
Switching Camera/Mic
Tutorial
Setting Camera Profile
Tutorial
Turn On/Off Camera/Mic
Tutorial
Screen Sharing
Tutorial
Detect Audio Volume
Tutorial
Custom Capturing and Rendering
Tutorial
Limit on the number of upstream users in a room
Tutorial
Environment and device check before calls
Tutorial
Check Environment and Device Before Calls
Tutorial
Detect Device Change
Tutorial
Enable Dual-Stream Mode
Tutorial
Enable Watermarking
Tutorial
explain
Learn more about the features of the TRTC web SDK here.
For FAQs, see Web.

Supported Platforms

The TRTC Web SDK supports all major browsers such as Chrome, Edge, Firefox, Safari, and Opera. In theory, the SDK supports all browsers based on Chromium version 56+.

If your browser is not in the list, you can use the API TRTC.isSupported() or run a TRTC Web SDK Support Level Test in the browser to test whether it fully supports WebRTC.
OS
Browser
Minimum BrowserVersion Requirements
Receive (Playback)
Send (Publish)
Share Screen
Windows
Chrome
56+
Yes
Yes
Chrome 72+
Firefox
56+
Yes
Yes
Firefox 66+
Edge
80+
Yes
Yes
Edge 80+
Opera
46+
Yes
Yes
Opera 60+
MacOS
Chrome
56+
Yes
Yes
Chrome 72+
Safari
11+
Yes
Yes
Safari 13+
Edge
80+
Yes
Yes
Edge 80+
Firefox
56+
Yes
Yes
Firefox 66+
Android
Chrome
69+
Yes
Yes
No
Edge
80+
Yes
Yes
No
Firefox
56+
Yes
Yes
No
Opera
46+
Yes
Yes
No
iOS
Chrome
iOS 11+
Yes
iOS 14.3+
No
Safari
iOS 11+
Yes
Yes
No
Edge
iOS 11+
Yes
iOS 14.3+
No
Firefox
iOS 11+
Yes
iOS 14.3+
No
Note
Due to H.264 copyright restrictions, H.264 encoding, which is required for stream publishing, is unavailable for Chrome versions earlier than v88 on Huawei devices. If you want to use the TRTC web SDK to publish streams on Chrome or Chrome WebView-based browsers on Huawei devices, please submit a ticket to enable VP8 encoding/decoding.
Firefox for macOS performs poorly in terms of screen sharing, and no solution has been found yet. We recommend you use Chrome or Safari instead.
For service stability and better online support, we recommend you to keep your SDK updated to the latest version. For notes on version updates, see Update Guide.

URL Protocol Support

Because of the security policies of browsers, when you use WebRTC, there are requirements on the protocol used for access. For details, see the table below.
Scenario
Protocol
Receive (Playback)
Send (Publish)
Share Screen
Remarks
Production
HTTPS
Yes
Yes
Yes
Recommended
Production
HTTP
Yes
No
No

Local development
Yes
Yes
Yes
Recommended
Local development
Yes
Yes
Yes

Local development
http://[local IP address]
Yes
No
No

Local development
file:///
Yes
Yes
Yes



Contact Us

Contact us on telegram or github.