Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

VideoExpress.Room.CameraPublisher

Methods Events 

Provides the mechanism for controlling the published stream. You can access the CameraPublisher via the camera property of the Room object, after you have successfully joined a session:

const room = new VideoExpress.Room(roomProperties);
await room.join();
const { camera } = room;

Methods

Name Description
(void) enableVideo () Enables the video track.
(void) disableVideo () Disables the video track.
(boolean) isVideoEnabled () Returns true when the video track is enabled. Otherwise it returns false.
(void) enableAudio () Enables the audio track.
(void) disableAudio () Disables the audio track.
(boolean) isAudioEnabled () Returns true when the audio track is enabled. Otherwise it returns false.
(void) setAudioDevice (deviceId)

Switches the audio input source. Pass in the device ID of the new audio source.

Calling this method results in an error (the Promise returned by the method is rejected) in the following conditions:

  • The browser does not support this method.
  • The publisher was not initiated with an audio source. (The audioSource option of the OT.initPublisher() method was set to nullcode> or false).
  • The user denied access to the audio input device.
  • There was an error acquiring audio from the audio input device or MediaStreamTrack object.
  • The audioSource value is not a string or MediaStreamTrack object.
  • The audioSource string is not a valid audio input device available to the browser.

(Promise<device>) getAudioDevice () Returns a device object which contains the deviceId, label and kind.
(void) setVideoDevice (deviceId)

This method sets the video source for a publisher that is using a camera. Pass in the device ID of the new video source.

The following result in errors:

  • The deviceId parameter is not a string or the device ID for a valid video input device, the promise is rejected with an error with the name property set to 'OT_INVALID_VIDEO_SOURCE'.
  • The publisher does not currently use a camera input, the promise is rejected with an error with the name property set to 'OT_SET_VIDEO_SOURCE_FAILURE'.

(device) getVideoDevice () Returns a device object which contains the deviceId, label and kind.

Events

Name Description
audioLevelUpdated Emits audioLevel (Number). Dispatched periodically by the camera publisher to indicate the audio level. This event is dispatched up to 60 times per second, depending on the browser. The audioLevel value is the audio level, from 0 to 1.0.
created Dispatched when the camera publisher is created. This event does not emit anything.
destroyed Dispatched when the camera publisher is destroyed. This event does not emit anything.
accessAllowed Dispatched when the user granted access to the device camera and mic. This event does not emit anything.
accessDenied Dispatched when the user denied access to the device camera and mic. This event does not emit anything.
accessDialogOpened Dispatched when the browser prompted a dialog box to allow or deny access to the camera and mic. This event does not emit anything.
accessDialogClosed Dispatched when the user closes the dialog box to allow or deny access to the camera and mic. This event does not emit anything.