mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-12 21:21:42 +08:00
Exposing active track to API
This commit is contained in:
Vendored
+14
-8
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+14
-8
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'));
|
||||
}
|
||||
|
||||
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 +110,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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user