Build a small program with audio and video Tencent cloud Demo

Tencent cloud provides a full set of technical documentation and source code to help you quickly build a video and audio small program, but even the best source code and documentation are also learning costs, in order as soon as possible be able to debug, we also offer a free one-click deployment services: You only need a few mouse clicks, you can get a small audio and video programs in their own account, and comes with a domain name of an independent test server, so that you can quickly build their own test environment within 5 minutes.
New Tencent cloud customer exclusive benefits 2860 yuan vouchers
https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=09ff33cfb418db124451885bff0af0c4&from=console

Hot Tencent cloud cloud offerings 3 fold
https://cloud.tencent.com/redirect.php?redirect=1014&cps_key=09ff33cfb418db124451885bff0af0c4&from=console

Web Solutions -3% OFF
https://cloud.tencent.com/redirect.php?redirect=1027&cps_key=09ff33cfb418db124451885bff0af0c4&from=console
through micro-channel public platform Tencent cloud unauthorized access details

Fine graphic version of the tutorial please refer to: build a small program with audio and video Demo cloud Tencent
open platform for micro-channel public register and login applet, proceed as follows:

Click on the left menu bar [Settings].
Click the right side of the Tab bar [Developer Tools].
Click [cloud] Tencent, Tencent to enter the cloud Tools page, click to open].
To bind small micro-channel scan code to authorize the applet Tencent cloud, the cloud will automatically go Tencent micro-channel after the opening of a small console program, displaying the development environment has been opened, can now proceed.
note:

At this point viewed through a small program developer tools Tencent cloud state and will not be displayed has been opened, it has opened status will not be synchronized to the micro-channel developer tools after the first deployment of a development environment.
Build a small program with audio and video Tencent cloud Demo

Tencent launched cloud

Tencent micro-channel cloud applet console
free open Tencent cloud service
1 launched video service
1.1 subscription video broadcast services
into the broadcast management console, if the service has not yet opened, will have the following tips:

Click subscribe, enter Tencent cloud after manual review stage, can be opened after approval.

Configuring live broadcast code
the video service opening, into the broadcast console []> [access code Live]> [Configuration] Access ( https://console.cloud.tencent.com/live/livecodemanage ) configuration completion, i.e., service can be opened live broadcast code:

Click [OK] button to access.

1.3 broadcast service configuration information acquisition
console acquire bizid, pushSecretKey, will be used later to configure the server from Live:

  1. The opening of cloud communication services
    2.1 subscribe to cloud communication services
    into the cloud communications management console, if it is not the service, click on the opening of direct communication cloud button. The new certification Tencent cloud account, the cloud communications applications list is empty, as shown below:

Click the Create button to create a new application access application access that you want to access App name Tencent IM cloud communications services, our test application name is called "RTMPRoom demonstration", as shown below:

点击确定按钮,之后就可以在应用列表中看到刚刚添加的项目了,如下图所示:

2.2 配置独立模式
上图的列表中,右侧有一个应用配置按钮,点击这里进入下一步的配置工作,如下图所示。

2.3 获取云通讯服务配置信息
从直播控制台获取SdkAppid、accountType、privateKey、administrator,后面配置服务器会用到:

从验证方式中下载公私钥,解压出来将private_key用文本编辑器打开,如:

-----BEGIN PRIVATE KEY-----
MIGHAgEAsUj5ep7r9TVxTrZiSpXQKhRANCAASuxr7AJGiXRqGpiO7pPrLAchyORc
Y5uWCqVm+QFTn0H+ZcHP93ss3OhgZKh8pq+g7X26dW5fQkiSH1PXG/FY
zbTbMHaWCqVm+QFTn0H+QKhRANCAASuxr7AJGiXRqGpiO7pPr7jTFTmg
-----END PRIVATE KEY-----
将其转换成字符串形式如下所示,后面在server配置文件中使用:

“-----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”
三、安装微信小程序开发工具
下载并安装最新版本的微信开发者工具,使用小程序绑定的微信号扫码登录开发者工具。

微信开发者工具
四、下载 Demo
访问 SDK+Demo,获取小程序 Demo 和后台源码。

五、上传和部署代码
打开第三步安装的微信开发者工具,点击【小程序项目】按钮。
输入小程序 AppID,项目目录选择上一步下载下来的代码目录,点击确定创建小程序项目。
再次点击【确定】进入开发者工具。
注意:

目录请选择 RTMPRoom 根目录。包含有 project.config.json,请不要只选择 wxlite 目录!

上传代码

Developer Tools
open config.js Demo code file in the server directory, wherein the bizid, pushSecretKey, APIKey, sdkAppID, accountType, administrator, privateKey configured to generate a value for the service in the cloud communication and broadcast service, and stored.

Password to modify MySQL
MySQL password]
Click on the upper right corner of Tencent [cloud] icon, select the [upload test code] in the dropdown menu bar.

Upload button
to select [module] to upload and check all the options, then check [after] deployed automatically install dependencies, click OK to start uploading code.

Select modules

Upload successful
after upload code completion, top right, click [Details] button, and then select the [state] you can see the cloud Tencent Tencent cloud is automatically assigned to your development environment domain:

See the developer domain
complete copy (including https: //) development environment request domain name, and then open the wxlite / config.js file in an editor, copy the url of the domain name filled in and saved, and then save the editor will automatically compile a small program , the left side of the window provides real-time simulator shows the client's Demo:

Modify Client Configuration
compiled to run more than clicking into the audio and video in the emulator, the console inside the right side you can see a successful login log configuration is successful.

Guess you like

Origin blog.csdn.net/qiyuwg/article/details/88991674