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.
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 }
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 }
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor