VirtuoWorks / CanvasCameraPlugin

Cordova/PhoneGap CanvasCamera Plugin
MIT License
38 stars 30 forks source link

Camerastream freezes (stops) when device camera is covered up. #15

Closed BHuys closed 5 years ago

BHuys commented 5 years ago

While experimenting using your plugin I noticed a strange behaviour. When I put down my device camera down during the stream and pick it up again, the process freezes.

const options = {
      cameraPosition:'back',
      use:'data',
      onAfterDraw: function(){
        if(!_this.videoReady){
          _this.set('videoReady',true);
        }
        else{
          if(!_this.get('positioned')&&_this.get('streaming')){
          _this.placeIndicators(parseInt(video.style.width), parseInt(video.style.height));
        }
        }
      }
    };
    const canvas = document.getElementById('testCanvas');
    window.plugin.CanvasCamera.initialize(canvas);
    window.plugin.CanvasCamera.start(options);

Testing with an emberJS based cordova app on IOS 12 safari wkwebview.

Sami-Radi commented 5 years ago

This might be related to #10 . When using data to render the frames, the iOS JavaScript garbage collector has difficulties to keep up.

The application memory consumption increases while time passes until the wkwebview is saturated. Try using the file option rather than data. However according to #10 it won't work on older iOS releases.

Best Regards,