merged master; fixed tests

This commit is contained in:
Christoph Oberhofer
2016-06-18 19:59:27 +02:00
17 changed files with 2819 additions and 1851 deletions
+5
View File
@@ -50,14 +50,19 @@ export default function createEventedElement() {
var event = getEvent(eventName),
subscribers = event.subscribers;
// Publish one-time subscriptions
subscribers.filter(function(subscriber) {
return !!subscriber.once;
}).forEach((subscriber) => {
publishSubscription(subscriber, data);
});
// remove them from the subscriber
event.subscribers = subscribers.filter(function(subscriber) {
return !subscriber.once;
});
// publish the rest
event.subscribers.forEach((subscriber) => {
publishSubscription(subscriber, data);
});
+8 -8
View File
@@ -34,11 +34,11 @@ function waitForVideo(video) {
function initCamera(video, constraints) {
return navigator.mediaDevices.getUserMedia(constraints)
.then((stream) => {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
streamRef = stream;
video.setAttribute("autoplay", 'true');
video.srcObject = stream;
video.addEventListener('loadedmetadata', (e) => {
video.addEventListener('loadedmetadata', () => {
video.play();
resolve();
});
@@ -51,13 +51,13 @@ function deprecatedConstraints(videoConstraints) {
const normalized = pick(videoConstraints, ["width", "height", "facingMode",
"aspectRatio", "deviceId"]);
if (typeof videoConstraints["minAspectRatio"] !== 'undefined' &&
videoConstraints["minAspectRatio"] > 0) {
normalized["aspectRatio"] = videoConstraints["minAspectRatio"];
if (typeof videoConstraints.minAspectRatio !== 'undefined' &&
videoConstraints.minAspectRatio > 0) {
normalized.aspectRatio = videoConstraints.minAspectRatio;
console.log("WARNING: Constraint 'minAspectRatio' is deprecated; Use 'aspectRatio' instead");
}
if (typeof videoConstraints["facing"] !== 'undefined') {
normalized["facingMode"] = videoConstraints["facing"];
if (typeof videoConstraints.facing !== 'undefined') {
normalized.facingMode = videoConstraints.facing;
console.log("WARNING: Constraint 'facing' is deprecated. Use 'facingMode' instead'");
}
return normalized;
@@ -69,7 +69,7 @@ function applyCameraFacing(facing, constraints) {
}
if ( typeof MediaStreamTrack !== 'undefined' &&
typeof MediaStreamTrack.getSources !== 'undefined') {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
MediaStreamTrack.getSources((sourceInfos) => {
const videoSource = sourceInfos.filter((sourceInfo) => (
sourceInfo.kind === "video" && sourceInfo.facing === facing
+1 -1
View File
@@ -561,7 +561,7 @@ export default function createLocator(inputImageWrapper, config) {
boxes = findBoxes(topLabels, maxLabel);
return boxes;
}
}
};
}
export function checkImageConstraints(inputStream, config) {
var patchSize,
-1
View File
@@ -7,7 +7,6 @@ import ResultCollector from './analytics/result_collector';
import Config from './config/config';
import {merge, pick, omitBy, isEmpty} from 'lodash';
function fromImage(config, imageSrc, inputConfig = {}) {
const staticImageConfig = {
inputStream: {