Exposing active track to API

This commit is contained in:
Christoph Oberhofer
2017-06-05 00:09:18 +02:00
parent ddc385641a
commit 012924fbe2
4 changed files with 42 additions and 24 deletions
+14 -8
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+14 -8
View File
File diff suppressed because one or more lines are too long
+13 -7
View File
@@ -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
};