Welcome toTencent Cloud + community, get more Tencent mass technology practice dry goods oh ~
This article is published by Tencent Video cloud terminal team in cloud + community column
Tencent cloud provides a full set of technical documents and source code to help you quickly build an audio and video small program, but no matter how good the source code and documentation also have learning costs, in order to debug as soon as possible, we also provide a free one-key deployment service: With just a few clicks of the mouse, you can get an audio and video applet under your own account. At the same time, a test server with an independent domain name is attached, so that you can quickly build your own test environment in 5 minutes.
Authorized to log in Tencent cloud through wechat public platform
Open the mini program for registration and login on wechat public platform and follow the following steps:
- Click Settings on the left menu bar.
- Click Developer Tools on the right Tab.
- Click “Tencent Cloud” to enter the Tencent Cloud tool page, and click “Open”.
- Use the wechat scan code bound to the small program to authorize the small program to Tencent Cloud. After opening, it will automatically enter the wechat small program console of Tencent cloud and show that the development environment has been opened. At this time, subsequent operations can be carried out.
Note:
At this time, checking the status of Tencent cloud through the small program developer tool will not show that it has been opened. The opened status will be synchronized to the wechat developer tool only after the first deployment of the development environment.
Open Tencent cloud service for free
1 Open live broadcast service
1.1 Apply for the Live video service
Enter the live broadcast management console. If the service is not enabled, the following prompt will be displayed:
Click to apply for the opening, and then enter the Tencent cloud manual review stage, after the review can be opened.
1.2 Configuring the Live Broadcast Code
Opening a live service, into the live broadcast of the console 】 【 > > live code access 】 【 】 【 access configuration (console.cloud.tencent.com/live/liveco…). To enable the live broadcast code service, complete relevant configurations:
Click “Confirm access” button.
1.3 Obtaining Live Broadcast Service Configuration Information
Obtain bizID and pushSecretKey from the live console, which will be used later to configure the server:
2. Enable the cloud communication service
2.1 Apply for cloud communication service
Enter the cloud communication management console, if there is no service, directly click the directly open cloud communication button. For newly authenticated Tencent cloud account, the list of cloud communication applications is empty, as shown below:
Click the “Create Application Access” button to create a new application access, that is, the name of the App you want to access Tencent cloud IM communication service. Our test application is called “RTMPRoom Demo”, as shown below:
Click OK and you’ll see the newly added project in the app list, as shown below:
2.2 Configuring independent Mode
In the list above, there is an application configuration button on the right. Click here to enter the next step of configuration, as shown in the picture below.
2.3 Obtaining Cloud Communication Service Configuration Information
Obtain SdkAppid, accountType, privateKey, and Administrator from the live console, which will be used later to configure the server:
Download the public and private keys from the authentication mode, unzip it and open private_key with a text editor, as shown in the following example:
-----BEGIN PRIVATE KEY-----
MIGHAgEAsUj5ep7r9TVxTrZiSpXQKhRANCAASuxr7AJGiXRqGpiO7pPrLAchyORc
Y5uWCqVm+QFTn0H+ZcHP93ss3OhgZKh8pq+g7X26dW5fQkiSH1PXG/FY
zbTbMHaWCqVm+QFTn0H+QKhRANCAASuxr7AJGiXRqGpiO7pPr7jTFTmg
-----END PRIVATE KEY-----
Copy the code
Convert it to the string form shown below, which will be used later in the server configuration file:
"-----BEGIN PRIVATE KEY-----\r\n"+
"MIGHAgEAsUj5ep7r9TVxTrZiSpXQKhRANCAASuxr7AJGiXRqGpiO7pPrLAchyORc\r\n"+
"Y5uWCqVm+QFTn0H+ZcHP93ss3OhgZKh8pq+g7X26dW5fQkiSH1PXG/FY\r\n"+
"zbTbMHaWCqVm+QFTn0H+QKhRANCAASuxr7AJGiXRqGpiO7pPr7jTFTmg\r\n"+
"-----END PRIVATE KEY-----\r\n"
Copy the code
Three, install wechat small program development tools
Download and install the latest version of the wechat developer tool, and log in to the developer tool using the wechat signal scanning code bound to the small program.
Download the Demo
Access SDK+Demo, obtain small program Demo and background source code.
Upload and deploy code
- Open the wechat developer tool installed in step 3 and click the “small program Project” button.
- Enter applets AppID, project directory select the code directory downloaded from the previous step, click OK to create applets project.
- Click ok again to enter the Developer tools.
Note:
Please select the RTMPRoom root directory. Json is included with project.config.json, please do not only select the WxLite directory!
-
Open the Demo code
server Copy the code
In the directory
config.js Copy the code
The document will be one of them
bizid Copy the code
,
pushSecretKey Copy the code
,
APIKey Copy the code
,
sdkAppID Copy the code
,
accountType Copy the code
,
administrator Copy the code
,
privateKey Copy the code
Configure to the values generated in the above live broadcast service and cloud communication service, and
save
.
Changing the MySQL password
-
Click the Tencent Cloud icon in the upper right corner of the interface and select upload Test Code from the drop-down menu bar.
-
Select “module upload” and check all options, then check “Automatically install dependencies after deployment” and click “OK” to start uploading the code.
Select the module
Uploaded successfully
-
After uploading the code, click the [Details] button in the upper right corner, and then select [Tencent Cloud Status] to see the development environment domain name automatically assigned to you by Tencent Cloud:
-
Full copy (inclusive
https:// Copy the code
) develop the environment request domain name and open it in the editor
wxlite/config.js Copy the code
File, and fill in the domain name of the copy
url Copy the code
After saving, the editor will automatically compile the small program, and the emulator window on the left can display the client Demo in real time:
Modify client configuration
-
Click multiplayer audio and video to enter, and you can see the log of successful login in the console on the right, indicating that the configuration is successful.
FAQ
1. Run a small program to enter the multi-player audio and video screen?
- Please confirm to use mobile phone to run, the simulator inside wechat developer tool does not support direct running at present
- Ensure that the basic program library version wx.getSystemInfo can query this information. Only the basic program library version 1.7.0 or later supports audio and video capabilities.
- Please confirm the category to which applets belong. Due to regulatory requirements, not all applets have developed audio and video capabilities. Please refer to DOC for supported categories.
- If you have more requirements or want in-depth cooperation, please contact us with work order or customer service number (400-9100-100).
Question and answer
How to build small program audio and video?
reading
Teach you to build your own “micro vision” in 1 day
The heart moves with ease, driving the engine of short video boom
Get through small program audio and video and webRTC
Machine learning in action! Quick introduction to online advertising business and CTR knowledge
This article has been authorized by the author to Tencent Cloud + community, more original text pleaseClick on the
Search concern public number “cloud plus community”, the first time to obtain technical dry goods, after concern reply 1024 send you a technical course gift package!
Massive technical practice experience, all in the cloud plus community!