useActiveVideo()

useActiveVideo(params?): Object

Contains a set of convenient properties, including which video inputs are available and available metadata for them.

The various IDs referenced below are video slot source IDs. These are opaque identifiers, meaning the values won't be meaningful to the reader. You can pass them to the src property of a <Video> component to render the video feed as the source.

Params (optional)

An object with the following properties:

ParameterRequiredTypeDescription
preferScreenshareNoBooleanWhen enabled, screen share inputs will be sorted before camera inputs. This is useful when prioritizing screen shares in your layout, especially when all inputs are not included in the final stream.

Return type

useActiveVideo() returns an object with the following propeties:

PropertyTypeDescription
activeIdsArrayCurrently active video source IDs.
activeScreenshareIdsArrayCurrently active video source ids that are of type 'screenshare'.
dominantIdString, nullThe first video source which has the 'dominant' flag set. In a video call context, the first video source with the 'dominant' flag is the active speaker. If none of the inputs are set as 'dominant', this will be null.
displayNamesByIdObjectA map of display names for each active video ID. Keys are video IDs, values are strings.
pausedByIdObjectA map of paused flags for each active video ID. Keys are video IDs, values are booleans.
maxSimultaneousVideoInputsNumberA count that indicates how many video inputs the embedding host can support. This number represents the number of simultaneous participant video connections the cloud server running the VCS composition can support. (E.g. 20 video connections.)

Sample code

Additional examples of usage for this custom hook can be found in the source code for the VCS SDK.