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

Orientation Bug on iOS 15. #276

Open
itsgmart opened this issue Sep 29, 2021 · 5 comments
Open

Orientation Bug on iOS 15. #276

itsgmart opened this issue Sep 29, 2021 · 5 comments

Comments

@itsgmart
Copy link

The sample codes work well on iOS 14 but since the new update, it will only work in landscape.

Page is loaded in Portrait mode but unable to scan anything.
Rotate the phone to Landscape mode and it works.

Notice that iOS 15, there was many changes to WebRTC so some experimental option affected this.

Thanks!

@itsgmart
Copy link
Author

Might have found the fixed. (Confirming with another iPhone iOS 15)
Fixed is only for Safari (Chrome seems like those option are default)
Setting > Safari > Advanced > Experimental Feature >Untick all GPU Process : *

@andrewgurn
Copy link

Might have found the fixed. (Confirming with another iPhone iOS 15) Fixed is only for Safari (Chrome seems like those option are default) Setting > Safari > Advanced > Experimental Feature >Untick all GPU Process : *

You're an absolute legend. This has solved the issue for me.

@huangsong
Copy link

edit scanner.js

    analyze() {
        if (!this.video.videoWidth) {
          return null;
        }
    
        //if (!this.imageBuffer) {
          let videoWidth = this.video.videoWidth;
          let videoHeight = this.video.videoHeight;
    
          this.sensorWidth = videoWidth;
          this.sensorHeight = videoHeight;
          this.sensorLeft = Math.floor((videoWidth / 2) - (this.sensorWidth / 2));
          this.sensorTop = Math.floor((videoHeight / 2) - (this.sensorHeight / 2));
    
          this.canvas.width = this.sensorWidth;
          this.canvas.height = this.sensorHeight;
    
          this.canvasContext = this.canvas.getContext('2d');
          this.imageBuffer = ZXing._resize(this.sensorWidth, this.sensorHeight);
          //return null;
        //}

fix this bug.

@ashu4code
Copy link

Now i test on IOS 14,ios 15 ,, Browser chrome safari..Instscan work well.

@ibnusulaiman83
Copy link

edit scanner.js

    analyze() {
        if (!this.video.videoWidth) {
          return null;
        }
    
        //if (!this.imageBuffer) {
          let videoWidth = this.video.videoWidth;
          let videoHeight = this.video.videoHeight;
    
          this.sensorWidth = videoWidth;
          this.sensorHeight = videoHeight;
          this.sensorLeft = Math.floor((videoWidth / 2) - (this.sensorWidth / 2));
          this.sensorTop = Math.floor((videoHeight / 2) - (this.sensorHeight / 2));
    
          this.canvas.width = this.sensorWidth;
          this.canvas.height = this.sensorHeight;
    
          this.canvasContext = this.canvas.getContext('2d');
          this.imageBuffer = ZXing._resize(this.sensorWidth, this.sensorHeight);
          //return null;
        //}

fix this bug.

how to find scanner.js files. I am using

<script type="text/javascript" src="plugins/instascan.min/instascan.min.js"></script>

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

5 participants