Run the demo of RTC SDK for Windows

更新时间:
复制 MD 格式

This topic describes how to run the demo of Real-Time Communication (RTC) SDK for Windows.

Prerequisites

You have obtained your authentication information from the console. For more information, see Access tools.

Note The token obtained from the console is for development and testing only. Using this token in a production environment poses a security threat. For production environments, you must set up 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
Device If you use a device that does not have a built-in camera and microphone, you need to connect the device to a webcam and microphone.
Windows version Windows XP (SP3), Windows 7, Windows 8.x, or Windows 10. Versions earlier than Windows XP (SP3) are not supported.

Procedure

  1. Download and decompress the software development kit (SDK) and sample code. For more information, see SDK download.
  2. Copy the SDK file to the MFC Demo directory of the sample code.
  3. Open the RTCSampleMainInterface.cpp file in the demo and locate the JoinChannel method. Configure the AuthInfo authentication parameter.
    authinfo.channel = CStringToAliString(m_sLoginInfo.s_strRoomID);
    authinfo.user_id = "a9e28****";
    authinfo.appid = "aoe****";
    authinfo.nonce = "AK-e5babe72e81a54fb9f580d4****";
    authinfo.token = "39cf7cde****";
    authinfo.gslb.AddString("https://rgslb.rtc.aliyuncs.com");
    authinfo.agent.AddString("");
    authinfo.timestamp = 1585363086;// The timestamp when the token expires. For example, 1560588594 indicates that the token expires at 16:49:54, June 15, 2019. 
  4. Run the demo.
    1. After you start the demo, on the homepage, click Settings to go to the parameter settings page. You can leave the service URL empty.

      If you want to connect to the web client, select Compatible with HTML5 Mode. Select Video Stream to ingest a video stream or Audio Stream to ingest an audio stream.

    2. Close the Settings page. Specify Channel Number and Username on the homepage, and click Create/Join Room.
    3. On the channel page that appears, the local preview window is displayed. Click Start to join the channel. When another user joins the channel, you can start a real-time audio or video call.

      You can also select Screen Sharing to share your screen with remote users.