in source/client/src/liveness/utils/MediaUtils.ts [16:55]
static loadMediaStream(successCallback: () => void, errorCallback: (message: string) => void) {
const constraints: MediaStreamConstraints = {
audio: false,
video: {
width: {
ideal: window.innerWidth,
max: parseInt(ConfigUtils.getConfig().MAX_IMAGE_WIDTH)
},
height: {
ideal: window.innerWidth,
max: parseInt(ConfigUtils.getConfig().MAX_IMAGE_HEIGHT)
},
facingMode: "user",
aspectRatio: 1.0
}
};
navigator.mediaDevices
.getUserMedia(constraints)
.then((mediaStream: MediaStream) => {
try {
const mediaStreamInfo = {
mediaStream: mediaStream,
actualHeight: mediaStream.getVideoTracks()[0].getSettings().height,
actualWidth: mediaStream.getVideoTracks()[0].getSettings().width
};
LogUtils.info(
`media info: actualHeight=${mediaStreamInfo.actualHeight} actualWidth=${mediaStreamInfo.actualWidth}`
);
(window as any).mediaStreamInfo = mediaStreamInfo;
} catch (error) {
LogUtils.error(error);
errorCallback("Error getting video actual sizes");
}
successCallback();
})
.catch(error => {
LogUtils.error(error);
errorCallback("Error getting access to the camera");
});
}