Welcome to cloud + community, get more Tencent mass technology practice dry goods oh ~
Author: Small program audio and video product manager
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: 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.
Enter the background of wechat public platform
Open Tencent Cloud
Tencent Cloud wechat mini program console
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.
Wechat developer tools
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!
Upload code
Developer tools
1. Open the Demo codeserver
In the directoryconfig.js
The document will be one of thembizid
,pushSecretKey
,APIKey
,sdkAppID
,accountType
,administrator
,privateKey
Configure and save the values generated in the above live broadcast service and cloud communication service.Changing the MySQL password
2. Click the Tencent Cloud icon in the upper right corner of the interface and select upload Test Code from the drop-down menu bar.
Upload button
3. Select “module upload” and check all options, then select “Automatic installation of dependencies after deployment” and click “OK” to start uploading the code.
Select the module
Uploaded successfully
4. 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:
View development domain name
5. Full copy (inclusivehttps://
) develop the environment request domain name and open it in the editorwxlite/config.js
File, and fill in the domain name of the copyurl
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
6. Compile and run in the simulator. Click multi-player audio and video to enter.
Log on to the test
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).
reading
Revealed micro channel small program solution: a tool to help developers improve efficiency
Wechat small program based on vientiane image to achieve picture OCR
Development of wechat applets for real-time speech recognition based on Tencent cloud intelligent voice
This article has been published by the author authorized cloud + community, please indicate the source of the original