question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having trouble with Classic Import rendering

See original GitHub issue

Describe the bug Using the classic import to include the <qrcode-stream @decode=“onDecode”>, <qrcode-stream> is embedded in mounts, but I don’t see the video box with a feed, no ask for permission, and I’m not getting a signal that it’s rendering within the component. See below!

To Reproduce This is a legacy project I inherited, and it’s been built in the HTML file with Vue templates, then new Vue component as a script, the component is embedded in the HTML. Weird and wonky, but it does work.

Steps to reproduce the behavior:

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

Vue is already imported in the file the same way qr-code-reader is: I downloaded the JS dist for qr-code-reader and import it like so at the top:

<script src="../js/vue-qrcode-reader.browser.js"></script>

Which makes <qrcode-stream> available, which I grab and put in a template.

Here’s the abbreviated template code:

<script type="text/x-template" id="decode">

    <div style="overflow-y: scroll">
      <div class="flexRow" >
        <div class="exercisePanel flexColumn" style="width:50%">
        <h2>DECODE</h2>
        <qrcode-stream @decode="onDecode" @beforeCreate="onInit"/>
      </div>
    <div>
</script>

That template is then rendered by a Vue instance which will render the component <decode> I’m abbreviating here, but including all the functions I have to listen for errors:

Vue.component('decode', {
  template: '#decode',
  methods: {
    onDecode (decodedString) {
      console.log(decodedString);
    },
    logErrors (promise) {
      promise.catch(console.error)
    },
    async onInit (promise) {
      console.log("Reached Init")
      try {
        await promise
        console.log(promise)
      } catch (error) {
        console.log("Error is:", error);
        if (error.name === 'NotAllowedError') {
          this.error = "ERROR: you need to grant camera access permisson"
        } else if (error.name === 'NotFoundError') {
          this.error = "ERROR: no camera on this device"
        } else if (error.name === 'NotSupportedError') {
          this.error = "ERROR: secure context required (HTTPS, localhost)"
        } else if (error.name === 'NotReadableError') {
          this.error = "ERROR: is the camera already in use?"
        } else if (error.name === 'OverconstrainedError') {
          this.error = "ERROR: installed cameras are not suitable"
        } else if (error.name === 'StreamApiNotSupportedError') {
          this.error = "ERROR: Stream API is not supported in this browser"
        }
      }
    }
}

Then that whole component is embedded in the HTML similar to this:

<html>
  [blah blah, CSS imports, JS imports]
  <div id="slides">
    <div class="dapp exercise ui">
      <decode></decode>
    </div>
  </div>
  [vue component stuff here for rendering purposes]
</html>

**Expected behavior**
I expect the video box to open up or at least get a ping from the `beforeCreate` hook, but not seeing that. No errors in the Chrome console. Serving this from a localhost. 

**Screenshots**


**Desktop (please complete the following information):**
 - OS: macOS Mojave
 - Chrome
 - Version 76

**Smartphone (please complete the following information):**
Not tried yet,

**Additional context**
Your Debugger page did allow me to access my video camera on this computer.


Any help is greatly appreciated!!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gruhncommented, Sep 8, 2019

Just replace beforeCreate from your example with init. Like so:

<qrcode-stream @init="onInit" />

I bet there is only a small problem in your code but I can’t tell without being able to tinker with it. If you setup the fiddle I’m pretty sure I’ll find it.

1reaction
gruhncommented, Sep 8, 2019

I see…

Well, the name init here has nothing to do with lifecycle hooks. init is a custom event just like decode. Also, as far as I know, lifecycle hooks in general are not automatically emitted as events. So you can’t register events like this:

<some-component
  @mounted="..."
  @created="..."
  @beforeCreate="..."
  ... />

Unless the child component explicitly emits them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import 'rendering' from 'gym.envs.classic_control ...
I got (with help from a fellow student) it to work by downgrading the gym package to 0.21.0. Performed the command pip install...
Read more >
[Bug Report] Atari envs rendering doesn't work #2656 - GitHub
ImportError: cannot import name 'rendering ' from 'gym.envs.classic_control'. I'm using python 3.7.6, tried both in mac terminal and in Jupiter ...
Read more >
Solved: AVI/MP4/MKV Cannot Render the File
Cannot Render The File on Media Player Classic? You'll find everything from why you're getting this error and various ways of fixing it...
Read more >
Lightroom Classic CC won't render photos in library view
So, my photos "are there" but they simply won't show up. I face the same problem in the import view. If I switch...
Read more >
Known Issues with Client-Side Rendering - Windows drivers
In some cases, the print processor of a printer driver that is not configured as a driver package might not be installed on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found