According to my understanding of the flash docs, you only need to check "Microphone.names.length" to find out whether there are any microphones at all. From the changeset:
+ if (Microphone.names.length) {
+   dev = flash.media.Microphone.getMicrophone();
+ }

That code may still produce a nullpointer-exception, namely in the case that there are microphone(s) installed, but the default microphone is in use ("getMicrophone()" without the device-index parameter may return the default microphone although it's already in use, at least I don't see any indication that the opposite applies).
Therefore I'd think the change needs to be like so (untested!):

dev = flash.media.Microphone.getMicrophone();
if (dev == null) {
  if ($debug) {
    if (Microphone.names.length) {
// warn default mic is in use
    } else {
// warn no mics found
    }
  }
  return;
}




On 12/13/2010 10:17 PM, Max Carlson wrote:
Change maxcarlson-20101213-EKD by maxcarl...@friendly on 2010-12-13 12:39:11 PST
     in /Users/maxcarlson/openlaszlo/trunk-clean
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Warn when microphone is in use or can't be found.

Bugs Fixed: LPP-9580 - Action script error thrown caused by mcrophone

Technical Reviewer: [email protected]
QA Reviewer: hminsky

Details: Per the docs at 
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001866.html
 check to be sure

Tests: test/video/test-microphone.lzx?lzr=swf10&debug=true runs like before, 
but should warn if a microphone can't be found.

Files:
M       lps/components/extensions/av/microphone.lzx

Changeset: 
http://svn.openlaszlo.org/openlaszlo/patches/maxcarlson-20101213-EKD.tar

Reply via email to