Home  >  Article  >  Web Front-end  >  How to use the video component to play videos in WeChat mini programs

How to use the video component to play videos in WeChat mini programs

亚连
亚连Original
2018-06-21 18:32:125008browse

This article mainly introduces the function of using the video component to play videos in the WeChat applet, and analyzes the specific implementation techniques of the video component to play local mp4 short videos in the form of examples. The source code is also attached for readers to download for reference. Friends who need it can refer to it.

The example in this article describes the video playback function of the WeChat applet using the video component. Share it with everyone for your reference, as follows:

Key code

① index.wxml

<video src="../../pages/video/movie.mp4" binderror="videoErrorCallback"></video>

② index.js

Page({
 data:{
  // text:"这是一个页面"
 },
 videoErrorCallback: function (e) {
  console.log(&#39;视频错误信息:&#39;+e.detail.errMsg);
 }
})

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to implement JSON data grouping optimization in Javascript

About this pointing problem in vue (detailed tutorial)

How to implement singleton mode in JavaScript

How to implement inserting content at a specified position in JS

About the multi-threaded runtime library in JavaScript (detailed tutorial)

About the use of pseudo arrays in JavaScript (detailed tutorial)

About how to merge Object values ​​in JavaScript

How to implement validation in Angular

How to implement table sorting in Angular

How to use localstorage and sessionstorage in Vue

How to implement import and export in vue element-ui

The above is the detailed content of How to use the video component to play videos in WeChat mini programs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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