From 56bcb65206825388d6101551b5e7557928b6a58e Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 29 Apr 2014 23:42:15 -0700 Subject: [PATCH] video case needs an error handler --- src/Posting/QR.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 241d38828..e0c4afffd 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -403,6 +403,7 @@ QR = else if /^video\//.test file.type video = $.el 'video' $.on video, 'loadedmetadata', => + return unless cb? {videoHeight, videoWidth, duration} = video max_height = Math.min(QR.max_height, QR.max_height_video) max_width = Math.min(QR.max_width, QR.max_width_video) @@ -420,6 +421,12 @@ QR = cb false else cb true + cb = null + $.on video, 'error', => + return unless cb? + QR.error "#{file.name}: Video appears corrupt" + cb false + cb = null video.src = URL.createObjectURL file else cb true