Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# bedrock-vue-barcode-scanner ChangeLog

## 1.6.1 - 2025-07-dd

### Fixed
- Fix camera config to allow video stream to render back camera on Android.

## 1.6.0 - 2025-06-30

### Added
Expand Down
16 changes: 9 additions & 7 deletions components/BarcodeScanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ export default {
const defaultCameraId =
backCameras.at(-1)?.deviceId ?? cameraList.value.at(-1)?.deviceId;
await scanner.start(
selectedCameraId.value ?? defaultCameraId,
getCameraScanConfig(), onScanSuccess, onError
);
{deviceId: {exact: selectedCameraId.value ?? defaultCameraId}},
getCameraScanConfig(),
onScanSuccess,
onError);
if(!selectedCameraId.value && cameraList.value.length) {
const selectedCamera = scanner.getRunningTrackSettings()?.deviceId;
updateSelectedCamera(selectedCamera);
Expand All @@ -108,7 +109,7 @@ export default {
}
await getZoomConstraints();
// Set focus mode
scanner.applyVideoConstraints({
await scanner.applyVideoConstraints({
advanced: [
{frameRate: 30},
{resizeMode: 'none'},
Expand Down Expand Up @@ -212,11 +213,12 @@ export default {
function getCameraScanConfig() {
const width = window.innerWidth;
const height = window.innerHeight;
const landscapeAspectRatio = width / height;
const portraitAspectRatio = height / width;
// must parse float aspect ratio value
const landscapeAspectRatio = parseFloat((width / height).toFixed(3));
const portraitAspectRatio = parseFloat((height / width).toFixed(3));
return {
videoConstraints: {
facingMode: 'environment',
facingMode: {exact: 'environment'},
aspectRatio: width < height ?
portraitAspectRatio :
landscapeAspectRatio
Expand Down