Skip to content

Instantly share code, notes, and snippets.

@NoelDavies
Created November 29, 2019 21:45
Show Gist options
  • Save NoelDavies/dbb5fcb83e207666740774516f00c34d to your computer and use it in GitHub Desktop.
Save NoelDavies/dbb5fcb83e207666740774516f00c34d to your computer and use it in GitHub Desktop.
cap card capture js
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