Added camera selection to example; Upgrade to webpack 2.2

This commit is contained in:
Christoph Oberhofer
2017-01-08 23:10:15 +01:00
parent 821d04a78b
commit 036fc30d48
12 changed files with 157 additions and 18 deletions
+25
View File
@@ -24,3 +24,28 @@ Math.imul = Math.imul || function(a, b) {
// the final |0 converts the unsigned value into a signed value
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
};
if (typeof Object.assign !== 'function') {
Object.assign = function(target) { // .length of function is 2
'use strict';
if (target === null) { // TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource !== null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
};
}
+14
View File
@@ -109,6 +109,11 @@ export function pickConstraints(videoConstraints) {
return Promise.resolve(normalizedConstraints);
}
function enumerateVideoDevices() {
return enumerateDevices()
.then(devices => devices.filter(device => device.kind === 'videoinput'));
}
export default {
request: function(video, videoConstraints) {
return pickConstraints(videoConstraints)
@@ -120,5 +125,14 @@ export default {
tracks[0].stop();
}
streamRef = null;
},
enumerateVideoDevices,
getActiveStreamLabel: function() {
if (streamRef) {
const tracks = streamRef.getVideoTracks();
if (tracks && tracks.length) {
return tracks[0].label;
}
}
}
};
+2 -1
View File
@@ -539,5 +539,6 @@ export default {
},
ImageWrapper: ImageWrapper,
ImageDebug: ImageDebug,
ResultCollector: ResultCollector
ResultCollector: ResultCollector,
CameraAccess: CameraAccess,
};