Exposing active track to API

pull/132/merge
Christoph Oberhofer 8 years ago
parent ddc385641a
commit 012924fbe2

22
dist/quagga.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -87,6 +87,15 @@ function enumerateVideoDevices() {
.then(devices => devices.filter(device => device.kind === 'videoinput')); .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 { export default {
request: function(video, videoConstraints) { request: function(video, videoConstraints) {
return pickConstraints(videoConstraints) return pickConstraints(videoConstraints)
@ -101,11 +110,8 @@ export default {
}, },
enumerateVideoDevices, enumerateVideoDevices,
getActiveStreamLabel: function() { getActiveStreamLabel: function() {
if (streamRef) { const track = getActiveTrack();
const tracks = streamRef.getVideoTracks(); return track ? track.label : '';
if (tracks && tracks.length) { },
return tracks[0].label; getActiveTrack
}
}
}
}; };

Loading…
Cancel
Save