Public
Edited
Aug 4, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
cameraConfig = {
const supports = navigator.mediaDevices.getSupportedConstraints();
if (supports.pan && supports.tilt && supports.zoom) {
try {
const opts = { video: { pan: true, tilt: true, zoom: true } };
const stream = await navigator.mediaDevices.getUserMedia(opts);

const [videoTrack] = stream.getVideoTracks();
const capabilities = videoTrack.getCapabilities();
const settings = videoTrack.getSettings();

document.querySelector("#video").srcObject = stream;
return {
settings,
capabilities,
video: videoTrack
};
} catch (error) {
return createHint({
content: `You've either denied the permissions prompt or matching media isn't available.`,
type: "error"
});
}
} else {
return createHint({
content: `Your browser or camera does not support the PTZ API.`,
type: "error"
});
}
}
Insert cell
{
const opts = {
advanced: [{ zoom, tilt, pan, brightness, contrast }]
};
await cameraConfig.video.applyConstraints(opts);
}
Insert cell
Insert cell
Insert cell
import { createHint } from "@selenecodes/hint-containers"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more