 
     enum LightError: ErrorType {
         case torchUnavailable
+    }
+
+    override func pluginInitialize() {
+      super.pluginInitialize()
+      NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(pageDidLoad), name: CDVPageDidLoadNotification, object: nil)
+      self.cameraView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: UIScreen.mainScreen().bounds.height))
     }
 
     func sendErrorCode(command: CDVInvokedUrlCommand, error: QRScannerError){

        }
    }

    // ---- BEGIN EXTERNAL API ----

    func prepare(command: CDVInvokedUrlCommand){

@objc(QRScanner)
class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {

    var cameraView: UIView!
    var captureSession:AVCaptureSession?
    var captureVideoPreviewLayer:AVCaptureVideoPreviewLayer?
    var metaOutput: AVCaptureMetadataOutput?
