@Link
Page({
/**
* 页面的初始数据
*/
data: {
isShow: “none”,
tempPath: “”,
duration: 0,
dataSize: 0,
videoWidth: 0,
videoHeight: 0
},
/**
* 加入视频
*/
addVideoTap: function (e) {
var that = this;
wx.chooseVideo({
sourceType: [‘album’, ‘camera’],
maxDuration: 60,
camera: ‘back’,
compressed: false,
success: function (res) {
that.setData({
isShow: “block”,
tempPath: res.tempFilePath,
duration: res.duration,
dataSize: res.size/1024,
videoWidth: res.width,
videoHeight: res.height,
});
}
});
},
/**
* 保存视频
*/
saveVideoTap: function () {
// 保存视频
var path = this.data.tempPath;
console.log(“路径:”, path);
wx.saveVideoToPhotosAlbum({
filePath: path,
success: function (res) {
console.log(“保存成功:”, res.errMsg);
wx.showToast({
title: “保存成功”,
icon: ‘success’,
duration: 5000
});
}
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})