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.

What happened with getDeviceById method?

See original GitHub issue

Hi there,

I was using the 1.3.0 version and today I have updated it to 1.5.0. After that, I have found that the getDeviceById method from the ZXingScannerComponent class does not exists anymore. So my question is what happened with this method? Have you changed the name or removed it? If it has been removed, is there any other method to get the device ID?

I did my code following your plunker demo (https://embed.plnkr.co/MN4riU/) and it is something like this:

  <zxing-scanner #scanner start="true" [device]="selectedDevice"
                 (scanSuccess)="handleQrCodeResult($event)"
                 (scanError)="handleQrCodeResult($event, true)"
                 (camerasNotFound)="camerasNotFound($event)"
                 (camerasFound)="camerasFound($event)"
                 (permissionResponse)="permissionResponse($event)"></zxing-scanner>
@Component({
  selector: 'app-qr-reader',
  templateUrl: './qr-reader.component.html',
  styleUrls: ['./qr-reader.component.scss']
})
export class QrReaderComponent implements OnInit {
  @ViewChild('scanner') scanner: ZXingScannerComponent;

  onDeviceSelectChange(selectedValue: string) {
      this.selectedDevice = this.scanner.getDeviceById(selectedValue);
  }

  [..]

Thanks for your help!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
odahcamcommented, May 27, 2019

Yes, my fault. It happens that I didn’t remember that there was such changes, it was a long time since I coded this release. Looks like a lot more people is using this lib now so I gotta be careful.

2reactions
odahcamcommented, May 24, 2019

team: me (hey!) 😆

Get device by ID is out, it was removed from 1.3 to 1.5. You can still filter devices by ID like this:

    this.scanner.camerasFound.subscribe((devices: MediaDeviceInfo[]) => {
      // selects the devices's back camera by default
      for (const device of devices) {
          if (device.id === myDeviceId) {
            return device;
          }
      }
    });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Class InputSystem | Package Manager UI website
This method adds a new usage to the device's set of usages. If the device already has the given usage, the method does...
Read more >
insynctive - npm Package Health Analysis - Snyk
{?Device} getDeviceById(id) - returns a Device object if found. This method assumes that call getDevices() has been already made.
Read more >
Troubleshooting memory leak when streaming serial device data to ...
I am building an application in Windows that can communicate with multiple serial devices. Sending and receiving data to a device is handled...
Read more >
golifx package - github.com/Arrendy/golifx - Go Packages
SubscriptionProvider, see the documentation for those methods below. ... NewClient returns a pointer to a new Client and any error that occurred ......
Read more >
angular populate disabled input field on a button click
Button click also happens in second component. I tried Input Output, but it seems this is only for parent-child connection.
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