How to use the video component in WeChat Mini Programs?

Published: 2021-12-15

In the Mini Program, you can use the video component to play the videos you want to display. The specific steps are as follows:


I. Add a video component

1. Click "Store" — "Decorate Store" — "Edit" to enter the Mini Program page editor.

image.png


2. Click "Component Library" — "Video". A video component will be added to the page. Click "Edit" on the video component.

image.png


3. On the right side of the page editor, there is a link. Just enter the video link. If you are using a video stored by yourself, you can directly select "Mini Program Video".

If you are calling Tencent Video, you need to enable the Tencent Video plugin and copy the Tencent Video link address.

image.png


II. Video link display methods

1. Mini Program Video(Recommended)

Advantages:

①. There is no size limit for uploaded videos, no need to wait for review (uploading illegal content is prohibited), and obtaining the link is convenient.

②. You can use platform authorization; there is no need to publish independently, and one-click publishing is simpler.

For setting methods, see Point 3. It is recommended to purchase our FSS Object Storage to save videos and add links.


2. Tencent Video

Advantages: Free

Disadvantages:

①. There are various restrictions and even review failures; videos will be watermarked with Tencent Video, there will be ads before video playback, and the user experience is relatively poor.

②. The Mini Program needs to be used under independent publishing mode. If it is currently platform publishing, you need to switch to independent publishing mode. For details, see the independent publishing mode tutorial https://www.west.cn/faq/list.asp?unid=2396 

③. You need to upload a code package with video. If it is not a code package with video, you need to download the code package containing video again and upload it via WeChat Developer Tools.

For setting methods, see Point 4.


III. Use our FSS Object Storage to add a video link (If you plan to use Tencent Video, please ignore this step)

1. Purchase; it is recommended to choose annual billing for greater convenience, because the Mini Program is charged annually. Choosing annual billing for FSS can synchronize with the Mini Program's usage period. You can choose the default configuration of 100G space and 100G traffic, or choose the space and traffic size according to your own situation.

image.png


2. Click "Cloud Storage Management" — "FSS Object Storage" — "File Management".

image.png


3. To facilitate management, click New Directory. The demo site created an APP directory, then created a movie directory under the APP directory to store videos. Then click "Upload" to upload videos.

image.png


4. Drag the file into the dashed box, or click "Click to Upload" to find the file and upload it.

image.png

The uploaded file cannot exceed 50M. If you want to upload large files, you can upload via FTP. The FTP information is as follows:

image.png


5. To allow normal external access, click "Permissions" and change the Bucket anonymous access permission setting to "Public Read".

image.png


6. In File Management, find the video you need to link to, click the arrow after Download, and select "Copy Access Path".

image.png


7. In the Mini Program's video component, paste the link you just copied (the copied link is in https format), then click Save.

image.png


Friendly reminder: To ensure smooth access for users on 4G or 5G networks, the following video parameters are recommended:

Encoding format: It is recommended to use MP4 videos based on the H.264 encoding format.

Resolution: Because mobile phone screens are limited, 720P or 1080P resolution is recommended.

Bitrate: It is recommended to keep it around 1Mbps.


IV. Use a Tencent Video link to add a video link (If you use our FSS Object Storage to add a video link, please ignore this step)

1. Enable the plugin: 1. On the WeChat platform (mp.weixin.qq.com) - Settings - Third-party Settings - Plugin Management, add the Tencent plugin.

image.png


2. In "Store" - "Plugin Management", enable the Tencent Video component. (If the first step is not performed, this component cannot be enabled.)

image.png



3. Obtain the Tencent Video link and add the Tencent Video link.

image.png