欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序 Video API實例詳解

 更新時間:2016年10月02日 09:30:43   作者:順子_RTFSC  
這篇文章主要介紹了 微信小程序 Video API實例詳解,需要的朋友可以參考下


電腦端不能測試拍攝功能只能測試選擇視頻功能,好像只支持mp4格式,值得注意的是成功之后返回的臨時文件路徑是個列表tempFilePaths而不是tempFilePath文檔寫的有點問題。

主要屬性:

wx.chooseVideo(object)

成功之后返回參數(shù)

wxml

<button type="primary" bindtap="listenerBtnOpenVideo">打開視頻</button>
<!--默認視頻組件是隱藏的-->
<video src="{{videoSource}}" hidden="{{videoHidden}}" style="width: 100%; height: 100%"/>

js

Page({
 data:{
  // text:"這是一個頁面"
  videoSource: '',
  videoHidden: true
 },

 listenerBtnOpenVideo: function() {
   var that = this;
   wx.chooseVideo({
     //相機和相冊
     sourceType: ['album', 'camera'],
     //錄制視頻最大時長
     maxDuration: 60,
     //攝像頭
     camera: ['front', 'back'],
     //這里返回的是tempFilePaths并不是tempFilePath
     success: function(res){
      console.log(res.tempFilePaths[0])
       that.setData({
         videoSource: res.tempFilePaths[0],
         videoHidden: false
       })
     },
     fail: function(e) {
      console.log(e)
     }
   })
 },

 onLoad:function(options){
  // 頁面初始化 options為頁面跳轉所帶來的參數(shù)
 },
 onReady:function(){
  // 頁面渲染完成
 },
 onShow:function(){
  // 頁面顯示
 },
 onHide:function(){
  // 頁面隱藏
 },
 onUnload:function(){
  // 頁面關閉
 }
})



感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關文章

最新評論