Flash Media Server Developer Documentation

Camera class

Use the Camera class to capture video from a camera attached to a computer running Flash Player. When used with Flash Media Server, this class lets you transmit, display, and optionally record the video being captured.

Flash Media Server provides similar audio capabilities; for more information, see the Microphone class entry.

Note: When a SWF file tries to access the camera returned by Camera.get(), Flash Player displays a Privacy dialog box in which the user can choose whether to allow or deny access to the camera. (Make sure that the Stage size is at least 215 by 138 pixels for the Camera class examples; this is the minimum size required to display the dialog box.) End users and administrative users can also disable camera access on a per-site or global basis.

Note: To create or reference a Camera object, use the Camera.get() method.

Availability

Flash Media Server (not required); Flash Player 6.

Method summary

Method

Description

Camera.get()

Returns a reference to a Camera object for capturing video.

Camera.setKeyFrameInterval()

Specifies which video frames are transmitted in full instead of being interpolated by the video compression algorithm.

Camera.setLoopback()

Specifies whether to use a compressed video stream for a local view of what the camera is transmitting.

Camera.setMode()

Sets aspects of the camera capture mode, including height, width, and frames per second.

Camera.setMotionLevel()

Specifies how much motion is required to invoke Camera.onActivity(true).

Camera.setQuality()

Sets the maximum amount of bandwidth per second or the required picture quality of the current outgoing video feed.

Property summary

Property (read-only)

Description

Camera.activityLevel

The amount of motion the camera is detecting.

Camera.bandwidth

The maximum amount of bandwidth the current outgoing video feed can use, in bytes.

Camera.currentFps

The rate at which the camera is capturing data, in frames per second.

Camera.fps

The maximum rate at which you want the camera to capture data, in frames per second.

Camera.height

The current capture height, in pixels.

Camera.index

A zero-based integer that specifies the index of the camera, as reflected in the array returned by Camera.names.

Camera.keyFrameInterval

A number that specifies which video frames are transmitted in full instead of being interpolated by the video compression algorithm.

Camera.loopback

A Boolean value that specifies whether a local view of what the camera is capturing is compressed (as it would be when transmitted by the server) or uncompressed.

Camera.motionLevel

A numeric value from 0 to 100 that specifies the amount of motion required to invoke Camera.onActivity(true).

Camera.motionTimeOut

The number of milliseconds between the time the camera stops detecting motion and the time Camera.onActivity(false) is invoked.

Camera.muted

A Boolean value that specifies whether the user has allowed or denied access to the camera.

Camera.name

A string indicating the name of the camera as returned by the camera hardware.

Camera.names

Class property; an array of strings containing the names of all available video capture devices, including video capture cards and cameras.

Camera.quality

The level of picture quality, as determined by the amount of compression being applied to each video frame.

Camera.width

The current capture width, in pixels.

Event handler summary

Event

Description

Camera.onActivity()

Invoked when the camera starts or stops detecting motion.

Camera.onStatus()

Invoked when the user allows or denies access to the camera.