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

IOS11 - Web RTC compatability #54

Closed
ddwyer opened this issue Jul 1, 2017 · 18 comments
Closed

IOS11 - Web RTC compatability #54

ddwyer opened this issue Jul 1, 2017 · 18 comments

Comments

@ddwyer
Copy link

ddwyer commented Jul 1, 2017

Thankyou for this Great work,
we are trying to implement this code for scanning QR code in IOS browser , we are testing with the latest IOS11 beta which has support for Web RTC.

we have access to eth camera , and webRTC getUserMedia()

however i am getting a persistent error = Unhandled Promise Rejection: TypeError: Type error at line 13231

case 3:
return this._stream = i.sent, i.abrupt("return", window.URL.createObjectURL(this._stream));

also IOS webkit version which is RTC compatible = 604
so will probably need to update line 13168

if (!navigator.userAgent.match(/Version\/(\d+).(\d+)/)) return e.browser = "Unsupported webkit-based browser with GUM support but no WebRTC support.", e; e.browser = "safari", e.version = this.extractVersion(navigator.userAgent, /AppleWebKit\/([0-9]+)\./, 1), e.minVersion = 602 }
@ddwyer
Copy link
Author

ddwyer commented Jul 24, 2017

$500 Bounty

I am unable to resolve this issue
Perhaps a bounty of $500 would encourage someone who is more capable than me to solve this issue. I believe that IOS11 Beta now supports webRTC getUserMedia() .
You can see a working demo (only if you have iOS11 beta installed :-)

--> https://tokbox.com/developer/sdks/js/

--> https://tokbox.com/developer/beta/safari/

@ddwyer
Copy link
Author

ddwyer commented Sep 14, 2017

This bounty is still valid - and i will honor it.
we intend to use instascan in our project , but need some support (which we are prepared to pay for)
is there anyone who can
[1] solve the issue
[2] contribute open source code to the instascan project
[3] and earn a little bit of money for your efforts

@bchr02
Copy link

bchr02 commented Sep 16, 2017

+1

@lnorbert
Copy link

@ddwyer We implemented Instascan in out application recently. It's a great library and worked as expected. We didn't use the released version, but built a fresh one from master.

Here is what I did to get a fresh build to our app:

git clone git@github.com:schmich/instascan.git
cd instascan/
npm install gulp-cli -g
npm install
gulp release
cp dist/instascan.min.js /path/to/our/libraries/include/dir

Selecting a camera based on ID didn't work. It always used the front camera. We solved this by adding an ugly patch to camera.js:

diff --git a/src/camera.js b/src/camera.js
index 5403b3c..4a46e32 100644
--- a/src/camera.js
+++ b/src/camera.js
@@ -31,6 +31,11 @@ class Camera {
       }
     };

+    var userAgent = window.navigator.userAgent;
+    if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
+        constraints.video.facingMode = "environment";
+    }
+
     this._stream = await Camera._wrapErrors(async () => {
       return await navigator.mediaDevices.getUserMedia(constraints);
     });

I wouldn't create a PR for this change as it's not a nice solution. But it works, feel free to use it in your projects.

@jsmithdev
Copy link

Just fyi, in iOS11 beta the <video /> element needs attribute playsinline . Seemed to be a bug for awhile but now that it's out of beta soon idk...

serratus/quaggaJS@e8352c7#diff-afd7828cb7f3e7a1f8fe7305f50b5021

PaulKinlan/qrcode@b79718b

@ddwyer
Copy link
Author

ddwyer commented Sep 19, 2017

i can confirm that we followed the instructions by @Inorbert and shazam .. like magic it's all working.
we will look to improve what we have found and report back .
-- Darren

@PallasKatze
Copy link

This is fixed in /pull/78. Don't forget to manually include the latest webrtc-adapter in your project.

@ddwyer
Copy link
Author

ddwyer commented Sep 21, 2017

@PallasKatze is a javascript GURU - this is all working now and maybe should be tested and merged ? in case anybody is interested the bounty was paid in full -- thanks for your help.

@ddwyer ddwyer closed this as completed Sep 21, 2017
@anthonyyuan
Copy link

why do I not work it on safari11
var userAgent = window.navigator.userAgent;

  • if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
  •    constraints.video.facingMode = "environment";
    
  • }
  • this._stream = await Camera._wrapErrors(async () => {
    return await navigator.mediaDevices.getUserMedia(constraints);
    });

@jerodfritz
Copy link

Here is a version that works compiled from https://github.com/centogram/instascan
instascan.zip

@pandalion
Copy link

@centogram is it possible for me to use the front camera with your ios11 code? thanks :)

@jerodfritz
Copy link

@pandalion yes, but you will need to modify the code. You'll just want to change the constraints.video.facingMode constraint from "environment" to "user".

@cpapazoglou
Copy link

@centogram work like a charm. Grats!

@adelsadek1
Copy link

@centogram @hrrsppzgl
which line I have to modify it?

@cpapazoglou
Copy link

cpapazoglou commented Nov 26, 2018

@centogram @hrrsppzgl
which line I have to modify it?

@adelsadek1
What do you really need? Have you downloaded @centogram modified code from here?
https://github.com/centogram/instascan

@adelsadek1
Copy link

@hrrsppzgl yes I have but still not working @centogram mentioned to modify line but I didn't which line I have to modify

@cpapazoglou
Copy link

@hrrsppzgl yes I have but still not working @centogram mentioned to modify line but I didn't which line I have to modify

Search for
facingMode: { exact: "environment" },
Change "environment" to "user"

image

@Govind13100
Copy link

Govind13100 commented Jul 15, 2019

Hi @lnorbert

I tried to follow your steps,

git clone git@github.com:schmich/instascan.git
cd instascan/
npm install gulp-cli -g
npm install
gulp release
cp dist/instascan.min.js /path/to/our/libraries/include/dir

But when try the first cmd, it throws the below error

Screenshot 2019-07-15 at 7 20 52 PM

Please, can you help me out here?

Thank you

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