DevicePanel class

Represents an OpenTok device panel, in which the client can select a microphone and camera. To display a device panel, call the displayPanel() method of a DeviceManager object.

The DevicePanel object dispatches a devicesSelected event when the user selects a device in the device panel.

Prior to calling the displayPanel() method, set the showMicSettings or showVideoSettings property of the DeviceManager object to false to disable the Microphone or Video settings in the panel. You would do this if you will publish in audio-only or video-only mode.

For a code example that uses the DevicePanel object, see DeviceManager Example.

See

DeviceManager.displayPanel()

DeviceEvent

DevicePanel properties

The DevicePanel object includes one property:

publisher (Publisher) — The publisher affected by the device panel settings.

Note: This property should only be used as read-only entities. The results of using JavaScript to directly change this property's value will be unpredictable.

DevicePanel methods

DevicePanel objects have the following methods.

Method Description
addEventListener(eventType:String, listener:Function) Registers a method as an event listener for a specific event.
removeEventListener(eventType:String, listener:Function) Removes an event listener for a specific event.

addEventListener(type:String, listener:Function)

Registers a method as an event listener for a specific event.

Parameters

type (String) — This string identifying the type of event. See DevicePanel events.

listener (Function) — The function to be invoked when the Publisher object dispatches the event.

See

DeviceEvent

removeEventListener()

removeEventListener(type:String, listener:Function)

Removes an event listener for a specific event.

Parameters

type (String) — The string identifying the type of event.

listener (Function) — The event listener function to remove.

The DevicePanel object throws an exception if the listener name is invalid.

See

addEventListener()

DevicePanel events

A DevicePanel object can dispatch two types of event:

Event type Event class Description
"closeButtonClick" Event The DevicePanel object dispatches a closeButtonClick when the user clicks the device panel's close button. The default behavior is to remove the device panel (associated with the close button) from the HTML page See Event.preventDefault().
"devicesSelected" DeviceEvent The DevicePanel object dispatches a devicesSelected when the user selects a camera or microphone in the device panel. For a code example that uses the devicesSelected event, see DeviceManager Example.

IRC Live Chat

Have a quick question? Chat with TokBox Support on IRC. Join chat