TRTC Web SDK
Overview
The TRTC SDK for Web is the web SDK of the Tencent Real-Time Communication (TRTC) solution. It is a JavaScript library loaded through HTML web pages. Developers can use the APIs provided by the TRTC SDK for Web to establish connections and control real-time audio/video calls or live streaming.
Currently, the TRTC SDK for Web supports Chrome M58+ and Safari browsers.
Be sure to use the HTTPS protocol or `localhost` to deploy your web app. Otherwise, failure to find navigator.mediaDevices will occur.
Basic Working Principle
The TRTC SDK for Web is the TRTC solution based on WebRTC. It establishes signaling channels with the TRTC backend server through WebSocket. The signaling channels are used for signaling communication for activities such as room entry and exit, media capability exchange, and user status change notification in rooms. Audio and video data is transmitted through WebRTC RTP/RTCP.
API Overview
- TRTC is the main entry to the entire TRTC SDK. You can use TRTC APIs to create a client object (Client) and local stream object (LocalStream), check a browser's compatibility, set log levels, and upload logs.
- A client object Client provides the core TRTC call capabilities, including entering a room join(), leaving a room leave(), publishing a local stream publish(), unpublishing a local stream unpublish(), subscribing to a remote stream subscribe(), and unsubscribing from a remote stream unsubscribe().
- Audio/video objects Stream include local stream LocalStream and remote stream RemoteStream objects. The APIs in Stream are general APIs for the local and remote streams.
- Local streams LocalStream are created via createStream().
- Remove streams RemoteStream are obtained through listening for 'stream-added' events from Client.on().