vue-barcode-reader icon indicating copy to clipboard operation
vue-barcode-reader copied to clipboard

How do we choose between back and front camera of celphones?

Open tkd-itsuki opened this issue 4 years ago • 5 comments

tkd-itsuki avatar Mar 09 '20 04:03 tkd-itsuki

It is currently not implemented as the code of the package shows. You might have to create a PR / your own package based on https://github.com/zxing-js/library

mrvnklm avatar May 28 '20 12:05 mrvnklm

How did you get it working on your phone ? I'm stuck as #12

rzfzr avatar Sep 24 '21 20:09 rzfzr

Don't really know anymore what the issue was but here is the code how I implemented it.

<template>
      <StreamBarcodeReader
        @decode="onDecode"
      ></StreamBarcodeReader>
</template>

<script>
  import {StreamBarcodeReader} from "vue-barcode-reader";

  export default {
    components: {
      StreamBarcodeReader
    },
    data() {
      return {
        scanned: false,
        code: ''
      }
    },
    methods: {
      onDecode(result) {
        if (this.scanned) return;
        this.scanned = true;
        let parts = result.split('/');
        let token = parts[parts.length - 1];
        console.log(token)
      }
    }
  }
</script>

mrvnklm avatar Sep 24 '21 21:09 mrvnklm

Nope, that is pretty much what I had, no sign of it on mobile, tried to enable camera permissions as default with no luck aswell Thanks

rzfzr avatar Sep 24 '21 21:09 rzfzr

Just added a PR so you can select the camera you preferred.

Regarding @rzfzr problem, did you already meet the requirements? Read the following stackoverflow situation.

TLDR: You can't access Microphone or Camera without a secure connection (website displayed over https).

You can use in develope enviroment by port forwarding to your phone. Connect your phone to your computer Enable ADB on your phone (search how to do it on google if u don't know) Go to dev tools in chrome "chrome://inspect/#devices" Add the ports you want to forward and open the localhost page on you phone (e.g. localhost:8080)

Cristian-Ayala avatar Nov 17 '21 20:11 Cristian-Ayala