Video Camera API

VideoCameraAPI Documentation

The VideoCameraAPI component provides a simple API for interacting with the video camera service from the Unity inspector. It allows you to enable/disable the video camera, switch between screen share mode and video camera mode, and set the resolution of the video output.

Namespace

MetaverseCloudEngine.Unity.Video.Components

Public Methods

  • void SetBackgroundBlur(bool value): Enables or disables background blur for the video camera output.

  • void SetScreenShare(bool value): Switches between screen share mode and video camera mode.

  • void SetVideoDisabled(bool value): Enables or disables the video camera.

  • void SetVideoEnabled(bool value): Enables or disables the video camera (opposite of SetVideoDisabled).

  • void SetResolution(string value): Sets the resolution of the video output. The expected format is "widthxheight" (e.g., "1920x1080").

Public Properties

  • VideoCameraEvents events: Events that are invoked when the video camera state changes.

Inspector Fields

  • VideoCameraEvents events: Events that are called when the video camera is enabled/disabled or when screen share mode is activated/deactivated.

Behavior

  • Execution Order: This class inherits from MetaSpaceBehaviour, which uses the default Unity execution order.

Usage

  1. To use VideoCameraAPI, start by adding the component to a GameObject in your scene.

  2. You can then use the public methods to control the video camera service. For example, to disable the video camera, you would call SetVideoDisabled(true).

  3. You can also listen to the events in the events property to trigger other behaviors when the video camera state changes. For example, you could listen to the onVideoDisabled event to deactivate a GameObject when the video camera is disabled.

Example:

You can use the VideoCameraAPI component to toggle the video camera on and off with a button click. To do this:

  1. Add the VideoCameraAPI component to a GameObject in your scene.

  2. Create a Button in your UI.

  3. Add a Unity Event to the Button's onClick event.

  4. In the Unity Event, select the GameObject that has the VideoCameraAPI component and then select the SetVideoDisabled method.

  5. In the SetVideoDisabled method call, pass in a boolean value that represents whether the video camera should be disabled or not.

This will toggle the video camera on and off when the Button is clicked.

Last updated