Home  >  Article  >  WeChat Applet  >  How to implement video playback in a small program

How to implement video playback in a small program

angryTom
angryTomOriginal
2020-03-21 11:38:0812707browse

How to implement video playback in a small program

How to implement video playback in a mini program

You can use the video component provided by WeChat to implement video playback in a mini program.

Recommended learning: Small program development

How to implement video playback in a small program

The specific implementation methods and steps are as follows:

1 , first write the video.wxml file


    
    

Note: You can select the album video to play through the button.

2. Then write the video.js file

Page({
  /**
   * 页面的初始数据
   */
  data: {
    src: 'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400',
  },
  bindButtonTap:function(){
    var that=this
    wx.chooseVideo({
      sourceType:['album','camera'],
      maxDuration:60,
      camera:['front','back'],
      succes:function(res){
        that.setData({
          src:res.tempFilePath
        })
      }
    })
  }
})

Rendering:

How to implement video playback in a small program

PHP Chinese website, a lot Free thinkphp tutorial, welcome to learn online!

The above is the detailed content of How to implement video playback in a small program. 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