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:
Parameter | Required | Type | Description |
---|---|---|---|
preferScreenshare | No | Boolean | When 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:
Property | Type | Description |
---|---|---|
activeIds | Array | Currently active video source IDs. |
activeScreenshareIds | Array | Currently active video source ids that are of type 'screenshare' . |
dominantId | String , null | The 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 . |
displayNamesById | Object | A map of display names for each active video ID. Keys are video IDs, values are strings. |
pausedById | Object | A map of paused flags for each active video ID. Keys are video IDs, values are booleans. |
maxSimultaneousVideoInputs | Number | A 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.