Name

mediadevice

Synopsis

LZX: mediadevice
JavaScript: lz.mediadevice
Type: Class
Access: public
Topic: Extensions.Audio-Video
Declared in: lps/components/extensions/av/mediadevice.lzx

Superclass Chain

node (LzNode) » mediadevice

Known Subclasses

Details

Properties (9)

active
<attribute name="active" value="false" />
public read-only var active;
Flag that tracks if there's device activity (audio sound, video motion).
allowed
<attribute name="allowed" />
public read-only var allowed;
Shared flag defined in mediadevice.prototype that tracks whether the user has allowed device access. Default: false. True after user has accepted security dialog, false if the user denies access with security dialog. Note: allowed is not defined in objects, but in the prototype. Initialized in the script at the end of the file.
_allowedknown
<attribute name="_allowedknown" />
private var _allowedknown;
Shared flag defined in mediadevice.prototype that tracks whether we've figured out if we're allowed or not. Default: false. Note: allowed is not defined in objects, but in the prototype. Initialized in the script at the end of the file.
capturing
<attribute name="capturing" value="true" />
public var capturing;
Boolean flag that controls if the media device is currently capturing input.
_dev
<attribute name="_dev" value="null" />
private var _dev;
Reference to internal Flash device object.
deviceindex
<attribute name="deviceindex" value="null" />
public var deviceindex;
Zero-based index of the device, or null for user's default device. Default is null, which selects the default device. When the default device is initialized, deviceindex is updated to its actual index.
devicename
<attribute name="devicename" type="string" value="" />
public read-only var devicename : String;
Name of the device.
_devinited
<attribute name="_devinited" value="false" />
private var _devinited;
If true, the device is initialized.
_instances
<attribute name="_instances" />
private var _instances;
Shared array defined in mediadevice.prototype that contains all mediadevice (or subclass) instances. Note: _instances is not defined in objects, but in the prototype. Initialized in the script at the end of the file.

Methods (14)

destroy()
<method name="destroy" />
private function destroy();
Destroy the media device. Removes the media device from the global list of media devices.
init()
<method name="init" />
private function init();
Initialize the device. Keeps track of all mediadevices in a list on the mediadevice class, so we can set all allowed changes to all devices.
_makeDevice()
<method name="_makeDevice" />
private function _makeDevice();
This should be defined in the subclass to do device specific device creation stuff. It should return the Flash device object.
_onActivity()
<method name="_onActivity" args="active" />
private function _onActivity(active);
Handler for the Flash device onActivity callback.
_onStatusStatic()
<method name="_onStatusStatic" args="info" />
private function _onStatusStatic(info);
Static method called on mediadevice.prototype, the handler for the Flash Camera onStatus callback. Info is the Flash status event name, like "Device.Action". This notifies all mediadevice instances that the allowed status changed. Don't call this on a mediadevice instance!
removeFromArray()
<method name="removeFromArray" args="a, obj" />
public function removeFromArray(a, obj);
Remove an object from an array.
_setCapturing()
<method name="_setCapturing" args="capturing" />
private function _setCapturing(capturing);
Setter for capturing attribute (true or false boolean). Subclasses should implement this device specific method. TODO: Move this to subclasses.
_setDeviceIndex()
<method name="_setDeviceIndex" args="index" />
private function _setDeviceIndex(index);
Setter for the device index attribute (0-based index, or null). If the index is null, the default device is selected. Changing deviceindex will try to open a different device, and set devicename if successful. Subclasses should implement this device specific method.
_setupDevice()
<method name="_setupDevice" />
private function _setupDevice();
This should be defined in the subclass to do set up the Flash device object.
showSettings()
<method name="showSettings" />
public function showSettings();
Show the Flash player settings dialog, so the user can change the device permission and other properties.
startDevice()
<method name="startDevice" />
private function startDevice();
Starts the device. This is called by init and _setDeviceIndex to set up the Flash device.
stopDevice()
<method name="stopDevice" />
public function stopDevice();
Stops the device.
_updateAllAllowedStatic()
<method name="_updateAllAllowedStatic" args="allowedNow" />
private function _updateAllAllowedStatic(allowedNow);
Static method called on mediadevice.prototype, that sets the allowed class variable and tells all mediadevices that allowed changed. Don't call this on a mediadevice instance!
_updateAllowed()
<method name="_updateAllowed" />
private function _updateAllowed();
Called on each mediadevice instance when the shared mediadevice.prototype.allowed value changes.

Events (5)

onactive
<attribute name="onactive" />
private event onactive;
Event sent when active flag changes.
onallowed
<attribute name="onallowed" />
private event onallowed;
Event sent when allowed status changes.
oncapturing
<attribute name="oncapturing" />
private event oncapturing;
Event sent when capturing flag changes.
ondeviceindex
<attribute name="ondeviceindex" />
private event ondeviceindex;
Event sent when device index changes.
ondevicename
<attribute name="ondevicename" />
private event ondevicename;
Event sent when device name changes.

LZX Synopsis

<class name="lz.mediadevice" extends=" LzNode ">
  <attribute name=" active " value="false" />
  <attribute name=" allowed " />
  <attribute name=" _allowedknown " />
  <attribute name=" capturing " value="true" />
  <attribute name=" _dev " value="null" />
  <attribute name=" deviceindex " value="null" />
  <attribute name=" devicename " type="string" value="" />
  <attribute name=" _devinited " value="false" />
  <attribute name=" _instances " />
  <method name=" destroy " />
  <method name=" init " />
  <method name=" _makeDevice " />
  <event name=" onactive " />
  <method name=" _onActivity " args="active" />
  <event name=" onallowed " />
  <event name=" oncapturing " />
  <event name=" ondeviceindex " />
  <event name=" ondevicename " />
  <method name=" _onStatusStatic " args="info" />
  <method name=" removeFromArray " args="a, obj" />
  <method name=" _setCapturing " args="capturing" />
  <method name=" _setDeviceIndex " args="index" />
  <method name=" _setupDevice " />
  <method name=" showSettings " />
  <method name=" startDevice " />
  <method name=" stopDevice " />
  <method name=" _updateAllAllowedStatic " args="allowedNow" />
  <method name=" _updateAllowed " />
</class>

JavaScript Synopsis

public lz.mediadevice extends  LzNode  {
  public read-only var active ;
  public read-only var allowed ;
  private var _allowedknown ;
  public var capturing ;
  private var _dev ;
  public var deviceindex ;
  public read-only var devicename  : String;
  private var _devinited ;
  private var _instances ;
  prototype private function destroy ();
  prototype private function init ();
  prototype private function _makeDevice ();
  prototype private event onactive ;
  prototype private function _onActivity (active);
  prototype private event onallowed ;
  prototype private event oncapturing ;
  prototype private event ondeviceindex ;
  prototype private event ondevicename ;
  prototype private function _onStatusStatic (info);
  prototype public function removeFromArray (a, obj);
  prototype private function _setCapturing (capturing);
  prototype private function _setDeviceIndex (index);
  prototype private function _setupDevice ();
  prototype public function showSettings ();
  prototype private function startDevice ();
  prototype public function stopDevice ();
  prototype private function _updateAllAllowedStatic (allowedNow);
  prototype private function _updateAllowed ();
}