阿宁啊
阿宁啊
  • 发布:2021-01-23 16:23
  • 更新:2021-01-23 19:17
  • 阅读:1112

为什么使用h5的startVideoCapture调起摄像头进行摄像后没有触发回调结果呢?摄像头倒是成功调起了

分类:uni-app
function videoCapture(){  
	console.log("录像")  
	const camera = plus.camera.getCamera();  
	const res = camera.supportedVideoResolutions[0];  
	const fmt = camera.supportedVideoFormats[0];  
	console.log("Resolution: "+res+", Format: "+fmt);  
	camera.startVideoCapture( function( path ){  
			console.log( "Capture video success: " + path );    
		},  
		function( error ) {  
			console.log( "Capture video failed: " + error.message );  
		},  
		{resolution:res,format:fmt}  
	);  
}

2021-01-23 16:23 负责人:无 分享
已邀请:
阿宁啊

阿宁啊 (作者)

解决啦,其实并不是没有执行,只是不知道为什么没有打印出来,试着在里面写uni.showuni.showToast({title:"执行了"})都能运行,如果要在里面打印得包一层定时器。

function videoCapture(){    
    console.log("录像")    
    const camera = plus.camera.getCamera();    
    const res = camera.supportedVideoResolutions[0];    
    const fmt = camera.supportedVideoFormats[0];    
    console.log("Resolution: "+res+", Format: "+fmt);    
    camera.startVideoCapture( function( path ){    
            uni.showToast({title: "执行了"});  
            setTimeout(() => {  
                 console.log( "Capture video success: " + path );    
            })  
        },    
        function( error ) {    
            console.log( "Capture video failed: " + error.message );    
        },    
        {resolution:res,format:fmt}    
    );    
}

该问题目前已经被锁定, 无法添加新回复