summaryrefslogtreecommitdiff
path: root/js/camera.js
diff options
context:
space:
mode:
authorJules <jules@asdf.us>2014-08-04 13:48:24 -0400
committerJules <jules@asdf.us>2014-08-04 13:48:24 -0400
commit73898a7939c810b4485d3226a5d1952827860668 (patch)
tree8b316e24d4dc8d64d75d097b47608a4412cf506d /js/camera.js
parent458127dd6142eaf39d1e97dd8cd3b306cc739f71 (diff)
defer camera load in firefox
Diffstat (limited to 'js/camera.js')
-rw-r--r--js/camera.js5
1 files changed, 5 insertions, 0 deletions
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)