mirror of https://github.com/vladmandic/human
add camera startup diag messages
parent
4ab5bbb6e6
commit
da7721d580
|
@ -9,8 +9,9 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
### **HEAD -> main** 2021/05/24 mandic00@live.com
|
### **HEAD -> main** 2021/05/25 mandic00@live.com
|
||||||
|
|
||||||
|
- implemented unified result.persons that combines face, body and hands for each person
|
||||||
- added experimental results interpolation for smooth draw operations
|
- added experimental results interpolation for smooth draw operations
|
||||||
|
|
||||||
### **1.9.3** 2021/05/23 mandic00@live.com
|
### **1.9.3** 2021/05/23 mandic00@live.com
|
||||||
|
|
|
@ -304,10 +304,19 @@ async function setupCamera() {
|
||||||
ui.busy = false;
|
ui.busy = false;
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
// enumerate devices for diag purposes
|
||||||
|
const devices = await navigator.mediaDevices.enumerateDevices();
|
||||||
|
log('enumerated devices:');
|
||||||
|
for (const device of devices) log(` kind:${device.kind} label:${device.label} id:${device.deviceId}`);
|
||||||
|
|
||||||
let stream;
|
let stream;
|
||||||
const constraints = {
|
const constraints = {
|
||||||
audio: false,
|
audio: false,
|
||||||
video: { facingMode: ui.facing ? 'user' : 'environment', resizeMode: ui.crop ? 'crop-and-scale' : 'none' },
|
video: {
|
||||||
|
facingMode: ui.facing ? 'user' : 'environment',
|
||||||
|
resizeMode: ui.crop ? 'crop-and-scale' : 'none',
|
||||||
|
// deviceId: 'xxxx' // if you have multiple webcams, specify one to use explicitly
|
||||||
|
},
|
||||||
};
|
};
|
||||||
if (window.innerWidth > window.innerHeight) constraints.video.width = { ideal: window.innerWidth };
|
if (window.innerWidth > window.innerHeight) constraints.video.width = { ideal: window.innerWidth };
|
||||||
else constraints.video.height = { ideal: (window.innerHeight - document.getElementById('menubar').offsetHeight) };
|
else constraints.video.height = { ideal: (window.innerHeight - document.getElementById('menubar').offsetHeight) };
|
||||||
|
@ -328,8 +337,19 @@ async function setupCamera() {
|
||||||
ui.busy = false;
|
ui.busy = false;
|
||||||
return 'camera stream empty';
|
return 'camera stream empty';
|
||||||
}
|
}
|
||||||
|
const tracks = stream.getVideoTracks();
|
||||||
|
if (tracks && tracks.length >= 1) {
|
||||||
|
if (tracks.length >= 1) {
|
||||||
|
log('enumerated viable tracks:', tracks.length);
|
||||||
|
for (const t of tracks) log(` ${t.kind}: ${t.label}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ui.busy = false;
|
||||||
|
return 'no camera track';
|
||||||
|
}
|
||||||
const track = stream.getVideoTracks()[0];
|
const track = stream.getVideoTracks()[0];
|
||||||
const settings = track.getSettings();
|
const settings = track.getSettings();
|
||||||
|
log('selected camera:', track.label, 'id:', settings.deviceId);
|
||||||
// log('camera constraints:', constraints, 'window:', { width: window.innerWidth, height: window.innerHeight }, 'settings:', settings, 'track:', track);
|
// log('camera constraints:', constraints, 'window:', { width: window.innerWidth, height: window.innerHeight }, 'settings:', settings, 'track:', track);
|
||||||
ui.camera = { name: track.label.toLowerCase(), width: settings.width, height: settings.height, facing: settings.facingMode === 'user' ? 'front' : 'back' };
|
ui.camera = { name: track.label.toLowerCase(), width: settings.width, height: settings.height, facing: settings.facingMode === 'user' ? 'front' : 'back' };
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
|
|
@ -67,8 +67,8 @@
|
||||||
"@vladmandic/pilogger": "^0.2.17",
|
"@vladmandic/pilogger": "^0.2.17",
|
||||||
"canvas": "^2.8.0",
|
"canvas": "^2.8.0",
|
||||||
"chokidar": "^3.5.1",
|
"chokidar": "^3.5.1",
|
||||||
"dayjs": "^1.10.4",
|
"dayjs": "^1.10.5",
|
||||||
"esbuild": "^0.12.2",
|
"esbuild": "^0.12.3",
|
||||||
"eslint": "^7.27.0",
|
"eslint": "^7.27.0",
|
||||||
"eslint-config-airbnb-base": "^14.2.1",
|
"eslint-config-airbnb-base": "^14.2.1",
|
||||||
"eslint-plugin-import": "^2.23.3",
|
"eslint-plugin-import": "^2.23.3",
|
||||||
|
|
Loading…
Reference in New Issue