+
95
-

回答

  uni.chooseVideo({
				                count: 1,//只录制一个视频
				                sourceType: ['camera'],//开启视频相机
				                maxDuration: 10,//时长30s
				                mediaType: ['video'],//类型为视频
				                success: res => {    
				                    //录制成功         
				                    that.videoRecordingPath = res.tempFilePath;
									
									uni.compressVideo({
														src: res.tempFilePath,  
														quality: 'low', //'low':低,'medium':中,'high':高  
														success: function (res){            
															console.log('压缩后',res)
														//	that.videoUpload(res.tempFilePath);
														},
														fail: function (err) {
															uni.showToast({  
																title:'视频压缩失败',  
																icon:'none'
															},2000)
														}
													})
									
									
				                    //存储到本地
				                    
									},
				                fail: (err) => {
				            //提示
				                    uni.showToast({
				                        title: '视频录制失败!',
				                        duration: 2000
				                    });
				                }
				            
				           })

网友回复

我知道答案,我要回答