Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rear camera (ios) #105

Open
marvinex123 opened this issue Nov 24, 2017 · 11 comments
Open

Rear camera (ios) #105

marvinex123 opened this issue Nov 24, 2017 · 11 comments

Comments

@marvinex123
Copy link

marvinex123 commented Nov 24, 2017

Hello,
i have an issue, i cant switch from front to rear camera.

I tried with cameras[1] <- works great on Android device, for iOS is still front camera
I tried with video: { facingMode: 'environment'} <- then camera dont display

Do u know how to force rear Camera on iOS ?

BestRegards

@JoseCDB
Copy link

JoseCDB commented Dec 11, 2017

You have to change the facingMode parameter to "environment"

@ghost
Copy link

ghost commented Dec 26, 2017

JoseCDB, Could you provide example, please?

@ghost
Copy link

ghost commented Dec 26, 2017

My Code is:

Instascan.Camera.getCameras().then(function (cameras) {
//for example i have two devices - [0,1]
scanner.start(cameras[1]);
}

There is no difference what kind of number I set (0 or 1), the front camera is always displayed

@JoseCDB
Copy link

JoseCDB commented Dec 26, 2017

Hi rus-bit,

I forked instascan with some changes to make it work on my project.
Basically you have to change the facingMode to "environment".

This change is in camera.js file

You can check it out here: https://github.com/JoseCDB/instascan/tree/ios-rear-camera

Hope it helps

@ghost
Copy link

ghost commented Dec 27, 2017

JoseCDB, thank you!

Please , How can i get instascan.min.js from you source code? The Folder distr does not exist.

@labregowski
Copy link

@JoseCDB
I have the same question as @rus-bit , could you point us in the right direction on how to make a min.js from the source?
If you are from PT, Lisbon or Porto, I'll pay you a coffee. :)

@ghost
Copy link

ghost commented Jan 9, 2018

Hello @labregowski.

I succeeded to build instascan.js file from @JoseCDB fork from https://github.com/JoseCDB/instascan/tree/ios-rear-camera.

But now, i haven't any IOS device to check correct work

instascan.zip

@labregowski
Copy link

Hi @rus-bit.
Thanks for remembering me.
Have you noticed that Clamav detects a threat in the instascan.min.js you sent? I think it is a false positive but..... probably has something to do with some component that PallasKatze added.

I'll try to get an iOS device to test this soon.

Could you tell me how did you build the instascan.min.js? I am still not being able to do it. I'd be thankful to you.

@ghost
Copy link

ghost commented Jan 9, 2018

Hi, @labregowski

You must install gulp, and many dependecies, listed in file gulpfile.js and package.json

  • npm install gulp
  • gulp build

then see output to resolve any problems.

my package.json file fragment:
"devDependencies": {
"babel-plugin-syntax-async-functions": "^6.8.0",
"babel-plugin-transform-regenerator": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babelify": "^7.3.0",
"browserify": "^13.3.0",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.4",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^1.1.2"
},
"dependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-latest": "^6.24.1",
"fsm-as-promised": "^0.13.2",
"visibilityjs": "^1.2.6",
"webrtc-adapter": "^1.4.0"
}

Hope it helps

@labregowski
Copy link

labregowski commented Jan 10, 2018

Hi @rus-bit .
A friend with iOS 11 tested and it is not working : P
It requests camera access but, then, nothing.

BUt might be related to the parameters in the script (not the instascan.min,js)

Instascan.Camera.getCameras().then(function (cameras) {
        if (cameras.length > 0) {
          scanner.start(cameras[1]);
        } else {
          console.error('No cameras found.');
        }

Might I need to change this? what do you think?

@ghost
Copy link

ghost commented Jan 11, 2018

hi @labregowski . We tested too, and it works fine.
See example.
https://github.com/rus-bit/QrCodeHtmlScanner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants