Open RuledesignerSRL opened 2 years ago
// 'user' = front camera || 'environment' = rear camera facingMode = 'environment';
public get videoOptions(): MediaTrackConstraints {
const result: MediaTrackConstraints = {};
if (this.facingMode && this.facingMode !== '') {
result.facingMode = { ideal: this.facingMode };
}
return result;
}
I have the same problem as described in issue #59, I followed the directions for using MediaTrackConstraints and set the facingMode, but nothing happen. In order to write my code I took as a reference the example provided by you here
`<webcam [height]="500" [width]="500" [trigger]="triggerObservable" (imageCapture)="handleImage($event)" [allowCameraSwitch]="true" [switchCamera]="nextWebcamObservable" [videoOptions]="videoOptions" [imageQuality]="1" (cameraSwitched)="cameraWasSwitched($event)" (initError)="handleInitError($event)"
public facingMode: string = 'environment'; public get videoOptions(): MediaTrackConstraints { const result: MediaTrackConstraints = {}; if (this.facingMode && this.facingMode !== '') { result.facingMode = { ideal: this.facingMode }; } return result; }
I use: