Web
This topic describes how to integrate the Web SDK.
Notes
You can access the web client using the http://localhost or file:// protocol for local development. Use the https protocol in a production environment.
If you cannot access your development environment through localhost and the environment does not support the https protocol, you can use a proxy tool to forward https domain requests to your development environment.
Prerequisites
For more information about the environment requirements for the web client, see Browser compatibility and known issues.
Procedure
The SDK provides two integration methods: Universal Module Definition (UMD) and ES Module. It also supports TypeScript (ts) type definition files.
ES Module
Use npm or yarn to install dingrtc in your project.
npm install dingrtc --save // or yarn add dingrtcImport the module in your project's script file.
import DingRTC from 'dingrtc';
UMD
Download the Web SDK. For more information, see SDK downloads.
Include the SDK file in your project's HTML file.
// For example, download the SDK file, name it dingrtc.js, and place it in the same directory as the HTML file. <script src="./dingrtc.js"></script>In your project's script file, use the default property of the global DingRTC object as the engine entry point.
// For example, create a web client instance. const RTCEngine = DingRTC.default; const client = RTCEngine.createClient(); // Create a camera video track. const cameraTrack = RTCEngine.createCameraVideoTrack({ dimension: 'VD_640x480' })
For WeChat and Alipay mini programs, you can integrate an online page that is developed with JavaScript. Set the src attribute of the built-in web-view tag to the URL of the online page. For more information, see the official documentation from each vendor, such as the web-view for WeChat mini programs and the web-view for Alipay mini programs.
What to do next
After you integrate the SDK, you can implement basic Real-Time Communication features. For more information, see Implement basic features.