This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Abdou Ghr
Posted Sep 13 - Read on Facebook

Hello guys, anyone who has experienced 'tap to record or tap to take picture' with the camera control trigger. Seems that this doesn't work:

document.getElementById("view").addEventListener("click", function() {
context.drawImage(video, 0, 0, 640, 480);

Min-Sang Choi any idea? :)


Min-Sang Choi

I can't find any problem with the code. Think it's legit. This link might help you get there.

Abdou Ghr

this is exactly what i used but for some reason i got: "Cannot read property 'addEventListener' of null"...The element im calling 'view' is the container.

Min-Sang Choi

Did you set the div id properly? I can tell you more when i see the whole code. There are number of ways to achieve this.

Abdou Ghr

i think so: viewz = new View({
width: 640,
height: 400,
x: 0,
y: 160,
backgroundColor: "rgba(0, 0, 0, 0)"

viewz.html = "<div class=\"circle-200\"><video id=\"circle-video-400\" autoplay></video></div>";

successCallback = function(stream) { = stream;
if (window.URL) {
video400.src = window.URL.createObjectURL(stream);
} else {
video400.src = stream;

errorCallback = function(error) {
console.log("navigator.getUserMedia error: ", error);

navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

constraints = {
audio: false,
video: true

video400 = viewz._element.querySelector("#circle-video-400");

navigator.getUserMedia(constraints, successCallback, errorCallback);

Min-Sang Choi

Well i cant see div with id "view". Getting null error seems obvious.

Min-Sang Choi

Here's the source of my camera example. Its coffeescript but might give you an idea.

Read the entire post on Facebook