mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 22:01:38 +08:00
Merged master and fixed integrationtests
This commit is contained in:
@@ -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
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user