ccj 3 年之前
父节点
当前提交
ab93846112
共有 1 个文件被更改,包括 33 次插入15 次删除
  1. 33 15
      pages/mine/company/companyvideo.nvue

+ 33 - 15
pages/mine/company/companyvideo.nvue

@@ -181,24 +181,42 @@
 							this.isAlreadyRecord = true
 						} else if (res.status == "end") {
 							console.log("结束录像")
-							videoFilePath = res.filePath;
 							uni.showLoading({
-								title:"保存视频中"
-							})
-							uploadImage('mp4', videoFilePath, 'appData/',
-								result => {
-									uni.hideLoading()
-									// 上传成功回调函数
-									console.log('视频地址', result)
-									uni.setStorageSync("videoSrc",result)
-									uni.navigateBack({
-										delta:1
+								title: '压缩中...'
+							});
+							var that = this;
+							uni.compressVideo({
+								src: tempFilePath,  
+								quality: 'low', //'low':低,'medium':中,'high':高  
+								success: function (res){            
+									console.log('压缩后',res)
+									videoFilePath = res.tempFilePath;
+									uni.showLoading({
+										title:"保存视频中"
 									})
-									// uni.$u.route('/pages/mine/company/addcompany', {
-									// 	videoSrc: result,
-									// });
+									uploadImage('mp4', videoFilePath, 'appData/',
+										result => {
+											uni.hideLoading()
+											// 上传成功回调函数
+											console.log('视频地址', result)
+											uni.setStorageSync("videoSrc",result)
+											uni.navigateBack({
+												delta:1
+											})
+											// uni.$u.route('/pages/mine/company/addcompany', {
+											// 	videoSrc: result,
+											// });
+										}
+									)
+								},
+								fail: function (err) {
+									uni.showToast({  
+										title:'视频压缩失败',  
+										icon:'none'
+									},2000)
 								}
-							)
+							})
+							
 							//                uni.saveVideoToPhotosAlbum({
 							//                    filePath: plus.io.convertAbsoluteFileSystem(videoFilePath),
 							//                    success: function(e) {