DeviceOrientation
new DeviceOrientation({ handler: (args: DeviceOrientationEventArgs) => void; });
interface DeviceOrientationEventArgs { absolute: boolean; alpha: number | null; beta: number | null; gamma: number | null; }
new DeviceOrientation({
handler: (params) => {
result.innerHTML = JSON.stringify(params, null, 2);
}
}).initialize();
// Waiting for initialization...
DeviceMovement
new DeviceMovement({ handler: (args: DeviceMovementEventArgs) => void; });
interface DeviceMovementEventArgs { acceleration: DeviceMotionEventAcceleration | null; accelerationIncludingGravity: DeviceMotionEventAcceleration | null; rotationRate: DeviceMotionEventRotationRate | null; interval: number; }
new DeviceMovement({
handler: (params) => {
result.innerHTML = JSON.stringify(params, null, 2);
}
}).initialize();
// Waiting for initialization...
MIDI
new MIDI({ onEvent: (event: MIDIEvent) => void; });
MIDIEvent { channel: number | null; device: Partial<MIDIPort>; a: EventData | null; b: EventData | null; type: string; }
new MIDI({
onEvent: (params) => {
result.innerHTML = JSON.stringify(params, null, 2);
}
}).initialize();
// Waiting for initialization...
UserMediaStream
new UserMediaStream();
start(MediaStreamConstraints: { audio?: boolean | MediaTrackConstraints; peerIdentity?: string; preferCurrentTab?: boolean; video?: boolean | MediaTrackConstraints; })
const stream = new UserMediaStream();
const video = document.createElement("video");
video.srcObject = await stream.start({ audio: true, video: true });
video.autoplay = true;
video.controls = true;
result.appendChild(video);