Merged master and fixed integrationtests

This commit is contained in:
Christoph Oberhofer
2017-08-10 10:43:43 +02:00
11 changed files with 287 additions and 90 deletions
+16 -8
View File
@@ -42,7 +42,9 @@ function initCamera(video, constraints) {
.then((stream) => {
return new Promise((resolve) => {
streamRef = stream;
video.setAttribute("autoplay", 'true');
video.setAttribute("autoplay", true);
video.setAttribute('muted', true);
video.setAttribute('playsinline', true);
video.srcObject = stream;
video.addEventListener('loadedmetadata', () => {
video.play();
@@ -87,6 +89,15 @@ function enumerateVideoDevices() {
.then(devices => devices.filter(device => device.kind === 'videoinput'));
}
function getActiveTrack() {
if (streamRef) {
const tracks = streamRef.getVideoTracks();
if (tracks && tracks.length) {
return tracks[0];
}
}
}
export default {
request: function(video, videoConstraints) {
return pickConstraints(videoConstraints)
@@ -101,11 +112,8 @@ export default {
},
enumerateVideoDevices,
getActiveStreamLabel: function() {
if (streamRef) {
const tracks = streamRef.getVideoTracks();
if (tracks && tracks.length) {
return tracks[0].label;
}
}
}
const track = getActiveTrack();
return track ? track.label : '';
},
getActiveTrack
};
+12 -4
View File
@@ -212,11 +212,19 @@ function createScanner(pixelCapturer) {
}
function calculateClipping(canvasSize) {
const area = _config.detector.area;
const patchSize = _config.locator.patchSize || "medium";
const halfSample = _config.locator.halfSample || true;
if (_config.detector && _config.detector.area) {
const area = _config.detector.area;
const patchSize = _config.locator.patchSize || "medium";
const halfSample = _config.locator.halfSample || true;
return _checkImageConstraints({area, patchSize, canvasSize, halfSample});
return _checkImageConstraints({area, patchSize, canvasSize, halfSample});
}
return {
x: 0,
y: 0,
width: canvasSize.width,
height: canvasSize.height,
};
}
function update() {