Created
November 29, 2019 21:45
-
-
Save NoelDavies/dbb5fcb83e207666740774516f00c34d to your computer and use it in GitHub Desktop.
cap card capture js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.mediaDevices.enumerateDevices().then(devices => { | |
navigator.mediaDevices.getUserMedia({ | |
video: { | |
deviceId: devices.filter(device => device.kind === 'videoinput' && device.label.match(/AVerMedia Live/))[0].deviceId | |
} | |
}).then((stream) => { | |
const video = document.querySelector('video') | |
video.srcObject = stream | |
video.onloadedmetadata = (e) => video.play() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment