Run the Windows demo

更新时间:
复制 MD 格式

This topic describes how to run the Windows demo.

Prerequisites

You have obtained authentication information from the console. For more information, see User Guide.

Note

The token obtained from the console is for development and testing only. Using it in a production environment poses a security threat. Build your own server to generate tokens and use the HTTPS protocol. For more information, see Generate a token on the server-side.

Environment requirements

Type

Description

Terminal device

If you use a device without a built-in camera and microphone, connect an external camera and microphone.

System version

Windows 7, Windows 8.x, Windows 10, or Windows 11

Procedure

  1. Download and decompress the SDK and sample code. For the download link, see SDK download.

  2. Copy the SDK files to the DingRTCSample folder in the sample code.

  3. Open the DingRTCSampleDlg.cpp file in the DingRTCSample folder, locate the JoinChannel method, and configure the authentication information.

    ding::rtc::RtcEngineAuthInfo auth;
    auth.channelId  =  /* The channel ID */
    auth.appId      =  /* The application ID */
    auth.token      =  /* The token for channel authentication */
    auth.userId     =  /* The user ID */
    auth.gslbServer =  /* The GSLB address. This is optional. */;
    engine_->JoinChannel(auth, /* The display name */);
  4. Run the demo.

    1. After the demo starts, a dialog box appears that shows the version number of the SDK you are using:

      .

    2. Click OK. You automatically join the channel, and stream ingest and stream pulling start. If another user is already in the channel, you can start a video call:

    image

Note

To support channels with more than two users, you must add more windows and modify the restriction on `remoteUserId` in `LRESULT CDingRTCSampleDlg::OnUpdateUI(WPARAM wParam, LPARAM lParam)` to subscribe to more video streams.

You can control automatic stream ingest upon joining by modifying the `pub_video_when_join_` and `pub_audio_when_join_` variables.

You can control automatic stream pulling by modifying the `auto_sub_audio_`, `auto_sub_video_`, and `prefer_video_quality_` variables.

`GetTokenAsync()` is a method for retrieving a token from the app server. You must implement this method based on your app server's logic.

For multi-user communication, all users must use the same app ID and channel ID. Each user must have a unique user ID.