Hello!
I use Capacitor/Camera with PWA Eements.
The resolution of Photo is only 640x480. I need a maximum possible resolution.
I tested and found out, that the resolution can be set in costrants by camera initialization.
in Camera.tsx for example:
async componentDidLoad() {
this.defaultConstraints = {
video: {
facingMode: this.facingMode
}
};
// Figure out how many cameras we have
await this.queryDevices();
const maxResolutionConstraints = await this.getMaxPhotoResolutionConstraints();
// Initialize the camera
await this.initCamera(maxResolutionConstraints);
}
async getMaxPhotoResolutionConstraints() {
const stream = await navigator.mediaDevices.getUserMedia(Object.assign({ video: true, audio: false }, this.defaultConstraints));
const track = stream && stream.getTracks()[0];
const capabilities = track && track.getCapabilities();
return {
video: {
facingMode: this.facingMode,
width: { exact: capabilities.width.max },
height: { exact: capabilities.height.max },
}
};
}
Is it possible to improve this component and to add input properties with maximum width and height or a maximum possible resolution?