FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 1273 : Capture dies when opening unavailable camera.
Last modified: 2009-06-11 06:53
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
WONTFIX -
Pr
i
ority:
P2
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
adamkumpf
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2009-06-11 06:28
In the "init()" method of the Capture.java class, when a camera is not
found, it kills the app (via "parent.die()"). This is unfortunate for
applications that may want to try opening all possible cameras as any
camera that fails will halt execution and return.
I realize you may not want to pass the exception outside since novice users
are not likely to be familiar with try/catch loops, but perhaps printing
the stack trace, an error message, and returning null (or setting some
boolean that indicates success) would be sufficient warning and allow more
advanced users to work with multiple cameras more easily.
This is a very quick fix and could be added to the next version (1.0.6?).
Thanks,
Adam
kumpf@media.mit.edu
Additional Comment
#1 From fry 2009-06-11 06:39
i'll give it some thought.. the problem we were having is that people would
ignore what was in the console unless their app stopped, and then complain
that video wasn't working (while ignoring the error messages that told them
what went wrong).
a workaround in the meantime is to simply add a "public void die()" method
to your sketch, and have it just print the stack trace and not halt. in
fact, as long as that works, that's probably the better workaround.
Additional Comment
#2 From adamkumpf 2009-06-11 06:49
That's a great workaround; I tried it and it works just fine.
Here's what I ended up adding to the sketch (in case it helps others who
may want to do something similar).
public void die(String msg, Exception e){
System.out.println("Died (but staying alive) >> " + msg);
e.printStackTrace();
}
Thanks,
Adam
Additional Comment
#3 From fry 2009-06-11 06:53
cool, i'll close this in that case, but we'll have it available for others
who have the same issue.