This commit is contained in:
Lukas Herman
2020-11-04 05:43:40 +00:00
parent 9d98eb8aaf
commit 18b81bfba6
5 changed files with 15 additions and 5 deletions

View File

@@ -75,8 +75,18 @@ func main() {
log.Fatalf("Error unpacking the cascade file: %s", err)
}
devices := mediadevices.EnumerateDevices()
deviceID := ""
for _, device := range devices {
if device.Label == "video0" {
deviceID = device.DeviceID
}
}
mediaStream, err := mediadevices.GetUserMedia(mediadevices.MediaStreamConstraints{
Video: func(c *mediadevices.MediaTrackConstraints) {
c.DeviceID = prop.StringExact(deviceID)
c.FrameFormat = prop.FrameFormatExact(frame.FormatUYVY)
c.Width = prop.Int(640)
c.Height = prop.Int(480)