<template>
  camera view
  <video ref="video" autoplay></video>
</template>

<script>
export default {
  name: 'CameraView',
  props: [],
  components: {
  },
  data: function () {
    return {
    };
  },
  computed: {
  },
  methods: {
    async setup_camera() {
      const stream = await navigator.mediaDevices.getUserMedia({
        video: {
          facingMode: "environment",
        }
      });
      console.log(stream);
      this.$refs.video.srcObject = stream;
    },
  },
  mounted() {
    this.setup_camera();
  },
}
</script>

<style scoped>
</style>
