@solid-primitives/devices
Version:
Primitive that enumerates media devices
58 lines (57 loc) • 2.67 kB
TypeScript
/**
* Creates a list of all media devices
*
* @returns () => MediaDeviceInfo[]
*
* If the permissions to use the media devices are not granted, you'll get a single device of that kind with empty ids and label to show that devices are available at all.
*
* If the array does not contain a device of a certain kind, you cannot get permissions, as requesting permissions requires requesting a stream on any device of the kind.
*/
export declare const createDevices: () => import("solid-js").Accessor<MediaDeviceInfo[]>;
/**
* Creates a list of all media devices that are microphones
*
* @returns () => MediaDeviceInfo[]
*
* If the microphone permissions are not granted, you'll get a single device with empty ids and label to show that devices are available at all.
*
* Without a device, you cannot get permissions, as requesting permissions requires requesting a stream on any device of the kind.
*/
export declare const createMicrophones: () => import("solid-js").Accessor<MediaDeviceInfo[]>;
/**
* Creates a list of all media devices that are speakers
*
* @returns () => MediaDeviceInfo[]
*
* If the speaker permissions are not granted, you'll get a single device with empty ids and label to show that devices are available at all.
*
* Microphone permissions automatically include speaker permissions. You can use the device id of the speaker to use the setSinkId-API of any audio tag.
*/
export declare const createSpeakers: () => import("solid-js").Accessor<MediaDeviceInfo[]>;
/**
* Creates a list of all media devices that are cameras
*
* @returns () => MediaDeviceInfo[]
*
* If the camera permissions are not granted, you'll get a single device with empty ids and label to show that devices are available at all.
*
* Without a device, you cannot get permissions, as requesting permissions requires requesting a stream on any device of the kind.
*/
export declare const createCameras: () => import("solid-js").Accessor<MediaDeviceInfo[]>;
/**
* Creates a reactive wrapper to get device acceleration
* @param includeGravity boolean. default value false
* @param interval number as ms. default value 100
* @returnValue Acceleration: Accessor<DeviceMotionEventAcceleration | undefined>
*/
export declare const createAccelerometer: (includeGravity?: boolean, interval?: number) => import("solid-js").Accessor<DeviceMotionEventAcceleration | undefined>;
/**
* Creates a reactive wrapper to get device orientation
* @param interval number as ms. default value 100
* @returnValue { alpha: 0, beta: 0, gamma: 0 }
*/
export declare const createGyroscope: (interval?: number) => {
alpha: number;
beta: number;
gamma: number;
};