API reference

MvrVirtualCamera_create Function

In Header file metavr/virtualcamera/VirtualCamera.h
Register MvrVirtualCamera.
Sets virtualCameraHandle pointer to valid MvrVirtualCamera object if the registration was successful. Caller is responsible for unregistering and releasing the MvrVirtualCamera object using MvrVirtualCamera_destroy.
The MvrVirtualCameraConfiguration instance can be disposed right after the registration.
Requires permission based on camera source type:
  • For MVR_VIRTUAL_CAMERA_SOURCE_APP_DEFINED: requires horizonos.permission.CREATE_VIRTUAL_CAMERA
  • For other sources (PASSTHROUGH, AVATAR, SPATIAL): requires android.permission.CREATE_VIRTUAL_DEVICE (operating system usage only)
If the virtual camera service is not running, this call might block for up to 5 seconds until the service starts.

Signature

MvrVirtualCameraStatus MvrVirtualCamera_create(MvrVirtualCameraManagerHandle managerHandle, const MvrVirtualCameraConfiguration* configHandle, MvrVirtualCameraHandle* virtualCameraHandle)

Parameters

managerHandle: MvrVirtualCameraManagerHandle MvrVirtualCameraManager instance handle.
configHandle: const MvrVirtualCameraConfiguration*MvrVirtualCameraConfiguration instance handle with configuration for the virtual camera.
virtualCameraHandle: MvrVirtualCameraHandle* output pointer which will be set to valid MvrVirtualCamera handle if the registration was successful.

Returns

MvrVirtualCameraStatus MVR_VIRTUAL_CAMERA_STATUS_OK if the registration was successful, MVR_VIRTUAL_CAMERA_STATUS_INVALID_ARGUMENT if the managerHandle, configHandle or virtualCameraHandle is NULL, MVR_VIRTUAL_CAMERA_STATUS_SERVICE_NOT_FOUND if the registration failed because virtual camera service is not available, MVR_VIRTUAL_CAMERA_STATUS_PERMISSION_DENIED if the registration failed because caller doesn't have sufficient permissions for the operation.