Closed justinhenricks closed 6 years ago
Hi, be sure to set every background transparent, as specified in docs, otherwise you will not be able to see camera preview. In my case i had to set the css property "background: none" to html, body and jQuery mobile page. Qhen it's done scanning, revert every background to what it was before.
There is no camera preview but can scan qrcode and gain the text. I try to set every item background transparent but not work. Do I write the wrong code? html - file
<ion-content class="content" scroll="true" overflow-scroll="true">
<button class="button" ion-button (click)="qrscanner()">qrscanner</button>
</ion-content>
scss - file
page-home {
}
.content {
background: transparent
}
.buttuon {
background: transparent
}
As far as i can tell ypur code is incomplete ( there is also a typo: .buttuon
should be .button
): as I said before, you should set background:none
also to <html>
element and to <body>
element.
This is the code used in my app to make Camera Preview work: I actually use jQuery to dinamically change these css properties:
html , body, #my_page {
background: none;
}
Thanks for your reminder of my write error. I just set the ion-content background : none transparent
and got a transparent view.
It is not similar to the the example image. There is no box in the middle
Yes, you have to add it yourself. Just create a transparent image with a box in the middle and set the image as background. Below there's what i use in my app (it fits a 1080x1920 screen): Scanner background
Got it, thank you very much.
You are welcome!
hi @Story5 could you share your code as a starter template? Would be amazing!
@romanrast Hi, romanrast. here is my demo (qrscannerdemo), I just achieve showing a camera preview, but haven't code for a qrscanner view with a scanner background. Hope it can help!
Hi,
I have tried this code but for me it is not opening camera for android as well as iphone any tips. Thanks
There is a bug in the browser version. (browser version has got memory leak if you call show after scan, on android version you need to call show())
I have tested Story5 approach, which i think nice, but unfortunately not working.
There is a nav-decor in the css which should be transparent, i'm not sure, what is doing. I have tested only in browser because i have hacked previously, but i think it will work.
Instead of the push you need to use setRoot - the push means just add a new layer increasing the z-index, which does not solve any problem with the layer transparency.
Story5 solution anyway is good, if you have bunch of embedded content, just remove them from the root, and put back, when the camera is off, because now you have much less pain, just the simple page with some control button.
I resolved this issue by adding the following css. Hope this can help someone. .nav-decor{ background-color: transparent !important; }
Looks like this issue has been solved. Please feel free to open a new issue if you're still having trouble.
I'm not using Ionic, is there any solution? My camera didn't appear since I click my button to scan. Is there any best practice for this plugin?
@daksamedia try cloning this repo and running the tests for a working example. See the Readme for more details.
@bitjson I already tested it, but still didn't work. I'm using framework7 anyway. Is it possible?
What didn't work about it? Did the tests fail on your devices?
This plugin should work for all Cordova projects, javascript frameworks shouldn't matter.
@bitjson it's work in browser, but in my android device my camera didn't open.
on prepare action it gave a response, but camera didn't show up.
Trying to reproduce – when you ran the generated tests on Android, which buttons did you click/what order?
Worked great in Android, but in IOS is not showing the camera preview
I am running Cordova 6.4 along with Sencha Touch. The plugin is installed successfully but when I call the scan() method the camera in iOS and Android is not popping up. I can see when I open up the object that it says scanning and camera showing is true, in yet I see not camera. Anyone know what could be going on here?