为了账号安全,请及时绑定邮箱和手机立即绑定

小程序的本地视频保存问题,求教

小程序的本地视频保存问题,求教

//wx.wxml文件<view class="title">3.视频管理</view><view class="demo-box"><view class="title">视频管理综合应用</view><button bindtap="chooseVideo">选择视频</button><video id="myVideo" src="{{src}}" enable-danmu danmu-btn controls></video><button type="primary" size="mini" bindtap="play">播放</button><button type="primary" size="mini" bindtap="pause">暂停</button><button type="primary" size="mini" bindtap="saveVideo">保存</button><input placeholder="请在此处输入弹幕" bindblur="bindInputBlur"></input><button type="primary" size="mini" bindtap="bindSendDanmu">发送弹幕</button></view>//wx.js文件// pages/test5/test5.js//生成随机颜色function getRandomColor(){let rgb=[]for(let i=0;i<3;++i){let color=Math.floor(Math.random()*256).toString(16)color=color.length==i?'0'+color:colorrgb.push(color)}return '#'+rgb.join('')}Page({// data: {//   src:"http://localhost/music/Uptown Funk.mp4"// },chooseVideo:function(){var that=thiswx.chooseVideo({sourceType: ['album','camera'],maxDuration: 60,camera:'back',success: function(res) {that.setData({src:res.tempFilePath})}})},//开始播放play: function () {this.videoContext.play()},//暂停播放pause: function () {this.videoContext.pause()},//保存视频saveVideo: function () {var src=this.data.srcwx.saveVideoToPhotosAlbum({filePath:src,success: function(res) {wx.showToast({title: '保存成功'})}})},inputValue:'',//弹幕文本内容//更新弹幕文本bindInputBlur:function(e){this.inputValue=e.detail.value},//发送弹幕bindSendDanmu:function(){this.videoContext.sendDanmu({text:this.inputValue,color:getRandomColor()})},/**  * 生命周期函数--监听页面加载  */onLoad: function (options) {this.videoContext=wx.createVideoContext('myVideo')}})在模拟器和手机上测试的时候,其他功能都没问题,就是保存视频的功能(saveVideo)失效,请问应该怎么修改?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 2104 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信