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'));
|
.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
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user