From 73898a7939c810b4485d3226a5d1952827860668 Mon Sep 17 00:00:00 2001 From: Jules Date: Mon, 4 Aug 2014 13:48:24 -0400 Subject: defer camera load in firefox --- js/camera.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/camera.js b/js/camera.js index e03586a..ef4898a 100644 --- a/js/camera.js +++ b/js/camera.js @@ -24,6 +24,11 @@ var camera = (function(){ } function ready(){ + // defer here if necessary.. firefox fires "canplay" before videoWidth is available + if (! video.videoWidth) { + setTimeout(ready, 50) + return + } cc.canvas.width = actual_w = w = min(video.videoWidth, 400) cc.canvas.height = actual_h = h = video.videoHeight / (video.videoWidth/w) video.setAttribute('width', video.videoWidth) -- cgit v1.2.3-70-g09d2