How to use Tencent Video plug-in in WeChat mini program?

青灯夜游
Release: 2020-04-01 09:37:31
forward
6285 people have browsed it

How to use Tencent video plug-in in WeChat applet development? The following article will introduce you to the tutorial on how to use the Tencent video plug-in. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to use Tencent Video plug-in in WeChat mini program?

Abstract: When developing a mini program project, if you need to watch videos on the page, you need to use the Tencent video plug-in of the WeChat mini program, so that you can Reference Tencent Video in the page without using your own server for video playback, which saves a lot of server expenses.

When developing a mini program project, if you need to watch videos on the page, you need to use the Tencent Video plug-in of the WeChat mini program, so that you can reference Tencent Video in the page without using your own The server plays the video, saving a lot of server expenses. However, the documentation for the WeChat applet plug-in is very unclear, so I will write my solution here.

Introduce plug-ins into mini programs.

Enter the WeChat public platform, find the third-party service in the settings, and add the plug-in in the plug-in management. Search for Tencent Video, click Add, and open the details of Tencent Video, where you will find the appid and version number of the plug-in.

Then comes the code part, add

plugins: {
    tencentVideo: {
      version: 1.1.1,
      provider: wxa75efa648b60994b
    }
Copy after login

in app.json where version is the version number and provider is the appid.

Reference the components of the plug-in in the page that needs to be used

The official document does not have specific instructions on this method, so it will cause the problem that the txv-video corresponding to the playerid cannot be found

Open the json file that you want to use the plug-in page, and add

usingComponents: 
{
txv-video: plugin://tencentVideo/video
}
Copy after login

This means that the txv-video component can be used in the page

Use components in the page

Enter the wxml file and add

This step is very simple, vid is the vid of Tencent Video, playerid is the unique identification code of the txv-video, this component cannot be styled through CSS

Introduce in js

If you don’t want to control the plug-in in js, you don’t need to introduce it.

const TxvContext = requirePlugin(tencentVideo);

let txvContext = TxvContext.getTxvContext(\'txv1\');

txvContext.play(); / /Play

This is the entire process of successfully quoting the Tencent Video plug-in. I hope it can help people who also encounter problems using this plug-in.

Recommendation: " Mini Program Development Tutorial"

The above is the detailed content of How to use Tencent Video plug-in in WeChat mini program?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jisuapp.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!