Skip to content

Instantly share code, notes, and snippets.

@hamzamu
Created July 13, 2021 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamzamu/40039745e27ec950aba60b19a705f0a1 to your computer and use it in GitHub Desktop.
Save hamzamu/40039745e27ec950aba60b19a705f0a1 to your computer and use it in GitHub Desktop.
Meteor: Webcam access
<head>
<title>meteor-exp</title>
</head>
<body>
{{> camera}}
</body>
<template name="camera">
<video id="video" width="800" height="600"
autoplay></video>
</template>
import { Template } from 'meteor/templating';
import './main.html';
Template.camera.onRendered(function () {
navigator.mediaDevices.getUserMedia({
video: true,
audio: true
})
.then(function (stream) {
video.srcObject = stream
console.log({stream})
})
.catch(e => console.log(e.name + ": " + e.message));
var video = document.getElementById('video');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment