Overview

Last updated: 2021-10-20 16:20:30

    Supported Platforms

    Proposed by Google, the WebRTC technology is well supported by Chrome (desktop), Edge (desktop), Firefox (desktop), and Safari (desktop and mobile), but poorly or not supported by other platforms such as browsers on Android.

    If your application scenario is mainly in the education sector, consider using the TRTC SDK for Electron, which supports big and small (dual-channel) images, with more flexible screen sharing schemes and better recovery capabilities on poor network connections.

    OS Browser Minimum Browser
    Version Requirements
    SDK Version Requirements Receive (Playback) Send (Publish) Share Screen
    Windows Chrome (desktop) 56+ - Supported Supported Supported (on Chrome 72+)
    QQ Browser (desktop, WebKit core) 10.4+ - Supported Supported Not supported
    Firefox (desktop) 56+ 4.7.0+ Supported Supported Supported (on Firefox 66+)
    Edge (desktop) 80+ 4.7.0+ Supported Supported Supported
    Sogou Browser (desktop, WebKit core) 11+ 4.7.0+ Supported Supported Supported
    Sogou Browser (Trident core) - - Not supported Not supported Not supported
    Opera (desktop) 46+ 4.7.0+ Supported Supported Supported (on Opera 60+)
    360 Secure Browser (Blink core) 13+ 4.7.0+ Supported Supported Supported
    360 Secure Browser (Trident core) - - Not supported Not supported Not supported
    WeChat built-in browser (desktop) - - Supported Not supported Not supported
    WeCom built-in browser (desktop) - - Supported Not supported Not supported
    macOS Safari (desktop) 11+ - Supported Supported Supported (on Safari 13+)
    Chrome (desktop) 56+ - Supported Supported Supported (on Chrome 72+)
    Firefox (desktop) 56+ 4.7.0+ Supported Supported Supported (on Firefox 66+)
    Edge (desktop) 80+ 4.7.0+ Supported Supported Supported
    Opera (desktop) 46+ 4.7.0+ Supported Supported Supported (on Opera 60+)
    WeChat built-in browser (desktop) - - Supported Not supported Not supported
    WeCom built-in browser (desktop) - - Supported Not supported Not supported
    Android WeChat built-in browser (TBS core) - - Supported Supported Not supported
    WeChat built-in browser (XWEB core) - - Supported Supported Not supported
    WeCom built-in browser - - Supported Supported Not supported
    Chrome (mobile) - - Supported Supported Not supported
    QQ Browser (mobile) - - Not supported Not supported Not supported
    UC Browser (mobile) - - Not supported Not supported Not supported
    iOS 12.1.4+ WeChat built-in browser - - Supported Not supported Not supported
    iOS 14.3+ WeChat built-in browser WeChat 6.5+ N/A Supported Supported Not supported
    iOS WeCom built-in browser - - Supported Not supported Not supported
    iOS 11.1.2+ Safari (mobile) 11+ - Supported Supported Not supported
    iOS 12.1.4+ Chrome (mobile) - - Supported Not supported Not supported
    iOS 14.3+ Chrome (mobile) - - Supported Supported Not supported
    Note:

    • You can run the TRTC Web SDK Support Level Test in a browser, for example, WebView, to test whether the environment fully supports WebRTC.
    • Due to H.264 copyright restrictions, Chrome and Chrome WebView-based browsers on Huawei devices do not support the TRTC SDK for web.

    URL Protocol Support

    Scenario Protocol Receive (Playback) Send (Publish) Share Screen Remarks
    Commercial HTTPS Supported Supported Supported Recommended
    Commercial HTTP Supported Not supported Not supported
    Local development http://localhost Supported Supported Supported Recommended
    Local development http://127.0.0.1 Supported Supported Supported
    Local development http://[local IP address] Supported Not supported Not supported
    Local development file:/// Supported Supported Supported

    API Guide

    The tutorials below offer detailed instructions on how to use different APIs.

    Feature Sample Code
    Audio/Video call Tutorial
    Interactive live streaming Tutorial
    Switching cameras/mics Tutorial
    Setting local video attributes Tutorial
    Disabling/Enabling local audio/video Tutorial
    Screen sharing Tutorial
    Measuring volume Tutorial
    Custom capturing and rendering Tutorial
    Limit on the number of upstream users in a room Tutorial
    Adding background music and audio effects Tutorial

    TRTC

    Note:

    This document applies to 4.x.x versions of the TRTC SDK for web.

    TRTC is the main entry to the TRTC SDK for web. You can use TRTC APIs to create a client object (Client) and local audio/video stream object (Stream) for real-time communication, check a browser's compatibility and whether it supports screen sharing, as well as set the log output level and enable/disable log upload.

    API Description
    VERSION Version of the TRTC SDK for web
    checkSystemRequirements Checks whether a browser is compatible with the TRTC SDK for web. If not, ask users to download the latest version of Chrome.
    isScreenShareSupported Checks whether a browser supports screen sharing. Call this API before creating a screen sharing stream.
    getDevices Gets the list of media input/output devices.
    getCameras Gets the list of cameras.
    getMicrophones Gets the list of mics.
    getSpeakers Gets the list of speakers.
    createClient Creates a client object for real-time audio/video calls. This API needs to be called only once for each call.
    createStream Creates a local Stream object, which uses the publish() API to publish the local audio/video stream.

    TRTC.Logger

    TRTC.Logger provides APIs for log settings, including log output level setting and log upload enabling/disabling.

    API Description
    setLogLevel Sets the log output level.
    enableUploadLog Enables log upload.
    disableUploadLog Disables log upload.

    Client

    A client object (Client) is created through createClient() and represents an audio/video call.

    API Description
    setProxyServer Sets proxy servers. This API is suitable where you deploy proxy servers, e.g., Nginx + Coturn, by yourself.
    setTurnServer Sets TURN servers. This API is used together with setProxyServer() and is suitable where you deploy proxy and TURN servers by yourself.
    join Enters a room. This starts an audio/video call. If the room does not exist, the system will create the room automatically.
    leave Exits a room. This ends an audio/video call.
    publish Publishes the local audio/video stream. You should call this API only after you call join() to enter a room. You can publish only one local stream per audio/video call.
    unpublish Unpublishes the local stream.
    subscribe Subscribes to a remote stream.
    unsubscribe Unsubscribes from a remote stream.
    switchRole Switches user roles. This API works only in interactive live streaming scenarios (live).
    on Listens for client object events.
    getRemoteMutedState Gets the audio/video mute status of remote users in a room.
    getLocalAudioStats Gets the audio statistics of the published local stream. This API can be used only after publish() is called.
    getLocalVideoStats Gets the video statistics of the published local stream. This API can be used only after publish() is called.
    getRemoteAudioStats Gets the audio statistics of all remote streams.
    getRemoteVideoStats Gets the video statistics of all remote streams.

    LocalStream

    A local audio/video stream is created through createStream. LocalStream is a subclass of Stream.

    API Description
    initialize Initializes a local audio/video stream object.
    setAudioProfile Sets audio parameters. This API works only if it is called before initialize().
    setVideoProfile Sets video parameters. This API works only if it is called before initialize().
    setScreenProfile Sets screen sharing parameters. This API works only if it is called before initialize().
    setVideoContentHint Sets video content hint. This is mainly used to improve video encoding quality in different scenarios. This API works only if it is called before initialize().
    switchDevice Switches media input devices.
    addTrack Adds an audio or video track to the local stream.
    removeTrack Removes the video track of the local stream.
    replaceTrack Replaces the audio or video track of the local stream.
    play Starts playing the local audio/video stream.
    stop Stops playing the local audio/video stream.
    resume Resumes playing the local audio/video stream.
    close Closes the local audio/video stream.
    muteAudio Disables the audio track of the local stream.
    muteVideo Disables the video track of the local stream.
    unmuteAudio Enables the audio track of the local stream.
    unmuteVideo Enables the video track of the local stream.
    getId Gets the stream ID.
    getUserId Gets the ID of the user to whom the stream belongs.
    setAudioOutput Sets the audio output device.
    getAudioLevel Gets the current volume. This API works only if there is audio data in the local stream or a remote stream.
    hasAudio Queries whether there is an audio track.
    hasVideo Queries whether there is a video track.
    getAudioTrack Gets the audio track of the local stream.
    getVideoTrack Gets the video track of the local stream.
    getVideoFrame Gets the current video frame.
    on Listens for Stream events.

    RemoteStream

    A remote audio/video stream is obtained via the Client.on('stream-added') callback. RemoteStream is a subclass of Stream.

    API Description
    getType Gets the remote stream type. This API is mainly used to determine whether a remote stream is an audio-video primary stream or a video substream (which is usually a screen sharing stream).
    play Starts playing an audio/video stream.
    stop Stops playing an audio/video stream.
    resume Resumes playing an audio/video stream.
    close Closes an audio/video stream.
    muteAudio Disables the audio track of a stream.
    muteVideo Disables the video track of a stream.
    unmuteAudio Enables the audio track of a stream.
    unmuteVideo Enables the video track of a stream.
    getId Gets the stream ID.
    getUserId Gets the ID of the user to whom a stream belongs.
    setAudioOutput Sets the audio output device.
    setAudioVolume Sets the playback volume.
    getAudioLevel Gets the current volume. This API works only if there is audio data in the local stream or a remote stream.
    hasAudio Queries whether there is an audio track.
    hasVideo Queries whether there is a video track.
    getAudioTrack Gets the audio track of a stream.
    getVideoTrack Gets the video track of a stream.
    getVideoFrame Gets the current video frame.
    on Listens for Stream events.

    RtcError

    RtcError is the error object.

    API Description
    getCode Gets the error code.

    Contact Us

    If you have any questions, please email us at colleenyu@tencent.com.