在 AWS Device Farm 中,如果摄像头变黑,这意味着什么?
In AWS Device Farm if camera goes black, what it means?
我使用 cordova 和 "cordova-plugin-camera-preview" 插件制作了一个应用程序。我试图在 AWS Device Farm 上对其进行测试,但该插件应该显示视频捕获的屏幕截图是黑色的,当测试完成时它没有显示错误。
这是什么意思?
这是我用来获取视频捕获的两个函数(适用于我的 phone):
function captura_video() {
try{
window.canvas_video_temp = document.createElement("canvas");
window.contexto_video_temp = canvas_video_temp.getContext("2d");
var promisifiedOldGUM = function(constraints) {
var getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia);
if(!getUserMedia) {
return Promise.reject(new Error('Este dispositivo no esta preparado para el manejo de camara'));
}
return new Promise(function(resolve, reject) {
getUserMedia.call(navigator, constraints, resolve, reject);
});
}
if(navigator.mediaDevices === undefined) {
navigator.mediaDevices = {};
}
if(navigator.mediaDevices.getUserMedia === undefined) {
navigator.mediaDevices.getUserMedia = promisifiedOldGUM;
}
window.videoElement = document.getElementById("pantalla_video");
navigator.mediaDevices
.getUserMedia(window.constraints)
.then(
stream => {
window.videoElement.srcObject=stream;
window.videoElement.onloadedmetadata = () => {
if(window.interruptor_buscador == true){
auxiliar_1();
}else if(window.interruptor_enlace == true){
auxiliar_2();
}
window.videoElement.play();
bucle_cuadros();
};
}
).catch(
err => {
alert("Error mediaDevices: " + err.code);
}
);
}catch(err2){
alert("Error de captura de video: " + err2.message);
}
}
function bucle_cuadros(){
try{
if (window.videoElement.readyState === window.videoElement.HAVE_ENOUGH_DATA) {
//SOME DIRTY THINGS HERE
}
requestAnimationFrame(bucle_cuadros);
}catch(err){
alert("Error bucle_captura: " + err.message);
}
}
这是AWS Device Farm提供的截图:
谢谢
你是截屏还是用相机拍照?
https://aws.amazon.com/device-farm/faqs/
Q: Can I use the device camera?
Yes, you can use the device cameras, both front- and rear-facing. Due to the way the devices are mounted, images and videos may look dark and blurry.
我认为 Device Farm 中应该会出现此图像。
HTH
-詹姆斯
我使用 cordova 和 "cordova-plugin-camera-preview" 插件制作了一个应用程序。我试图在 AWS Device Farm 上对其进行测试,但该插件应该显示视频捕获的屏幕截图是黑色的,当测试完成时它没有显示错误。
这是什么意思?
这是我用来获取视频捕获的两个函数(适用于我的 phone):
function captura_video() {
try{
window.canvas_video_temp = document.createElement("canvas");
window.contexto_video_temp = canvas_video_temp.getContext("2d");
var promisifiedOldGUM = function(constraints) {
var getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia);
if(!getUserMedia) {
return Promise.reject(new Error('Este dispositivo no esta preparado para el manejo de camara'));
}
return new Promise(function(resolve, reject) {
getUserMedia.call(navigator, constraints, resolve, reject);
});
}
if(navigator.mediaDevices === undefined) {
navigator.mediaDevices = {};
}
if(navigator.mediaDevices.getUserMedia === undefined) {
navigator.mediaDevices.getUserMedia = promisifiedOldGUM;
}
window.videoElement = document.getElementById("pantalla_video");
navigator.mediaDevices
.getUserMedia(window.constraints)
.then(
stream => {
window.videoElement.srcObject=stream;
window.videoElement.onloadedmetadata = () => {
if(window.interruptor_buscador == true){
auxiliar_1();
}else if(window.interruptor_enlace == true){
auxiliar_2();
}
window.videoElement.play();
bucle_cuadros();
};
}
).catch(
err => {
alert("Error mediaDevices: " + err.code);
}
);
}catch(err2){
alert("Error de captura de video: " + err2.message);
}
}
function bucle_cuadros(){
try{
if (window.videoElement.readyState === window.videoElement.HAVE_ENOUGH_DATA) {
//SOME DIRTY THINGS HERE
}
requestAnimationFrame(bucle_cuadros);
}catch(err){
alert("Error bucle_captura: " + err.message);
}
}
这是AWS Device Farm提供的截图:
你是截屏还是用相机拍照?
https://aws.amazon.com/device-farm/faqs/
Q: Can I use the device camera?
Yes, you can use the device cameras, both front- and rear-facing. Due to the way the devices are mounted, images and videos may look dark and blurry.
我认为 Device Farm 中应该会出现此图像。
HTH
-詹姆斯