mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 13:51:37 +08:00
Added camera selection to example; Upgrade to webpack 2.2
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user