instascan icon indicating copy to clipboard operation
instascan copied to clipboard

Orientation Bug on iOS 15.

Open itsgmart opened this issue 2 years ago • 5 comments

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 avatar Sep 29 '21 16:09 itsgmart

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 : *

itsgmart avatar Sep 30 '21 19:09 itsgmart

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.

andrewgurn avatar Oct 01 '21 13:10 andrewgurn

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.

huangsong avatar Nov 23 '21 03:11 huangsong

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

ashu4code avatar Dec 04 '21 13:12 ashu4code

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

ibnusulaiman83 avatar Feb 13 '22 02:02 ibnusulaiman83