Add DeviceType to MediaDeviceInfo

This commit is contained in:
Lukas Herman
2020-02-13 22:19:14 -08:00
parent 350fab996e
commit 9917591ef4
2 changed files with 11 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
package mediadevices
import "github.com/pion/mediadevices/pkg/driver"
// MediaDeviceType enumerates type of media device.
type MediaDeviceType int
@@ -12,7 +14,8 @@ const (
// MediaDeviceInfo represents https://w3c.github.io/mediacapture-main/#dom-mediadeviceinfo
type MediaDeviceInfo struct {
DeviceID string
Kind MediaDeviceType
Label string
DeviceID string
Kind MediaDeviceType
Label string
DeviceType driver.DeviceType
}

View File

@@ -279,10 +279,12 @@ func (m *mediaDevices) EnumerateDevices() []MediaDeviceInfo {
default:
continue
}
driverInfo := d.Info()
info = append(info, MediaDeviceInfo{
DeviceID: d.ID(),
Kind: kind,
Label: d.Info().Label,
DeviceID: d.ID(),
Kind: kind,
Label: driverInfo.Label,
DeviceType: driverInfo.DeviceType,
})
}
return info