微信小程序添加视频video组件Rolan2017-9-1600:50

1397添加视频video组件

小程序视频组件video标签

wxmlView1.播放网络视频/Viewviewvideostyle"width:100%;height400px;margin:1px;"src"http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400bizid1023hySHfileparam302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"binderror"videoErrorCallback"/video/viewView2.播放本地视频/Viewviewstyle"display:flex;flex-direction:column;"videostyle"width:100%;height400px;margin:1px;"src"{{src}}"/videoviewclass"btn-area"buttonbindtap"bindButtonTap"打开本地视频/button/view/view1234567891011js

Page({data:{src:''},/***打开本地视频*/bindButtonTap:function(){varthatthis//拍摄视频或从手机相册中选视频wx.chooseVideo({//album从相册选视频,camera使用相机拍摄,默认为:['album','camera']sourceType:['album','camera'],//拍摄视频最长拍摄时间,单位秒。最长支持60秒maxDuration:60,//前置或者后置摄像头,默认为前后都有,即:['front','back']camera:['front','back'],//接口调用成功,返回视频文件的临时文件路径,详见返回参数说明success:function(res){console.log(res.tempFilePaths[0])that.setData({src:res.tempFilePaths[0]})}})},/***当发生错误时触发error事件,event.detail{errMsg:'somethingwrong'}*/videoErrorCallback:function(e){console.log('视频错误信息:')console.log(e.detail.errMsg)}})

TAG标签: 微信小程序添加视频video组件微信小程序怎么添加视频微信小程序视频上传

http://www.xiaochengxub.com/read-96601.html