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"
});
}
}