     pause()
     webView.stopLoading()
     webView.configuration.userContentController.removeScriptMessageHandler(forName: DMPlayerViewController.messageHandlerEvent)
+    if loggerEnabled {
+        webView.configuration.userContentController.removeScriptMessageHandler(forName: DMPlayerViewController.consoleHandlerEvent)
+    }
   }
   
   /// Load a video with ID and optional OAuth token

    }
    controller.addUserScript(WKUserScript(source: source, injectionTime: .atDocumentStart, forMainFrameOnly: false))
    controller.add(Trampoline(delegate: self), name: DMPlayerViewController.messageHandlerEvent)
    return controller
  }
  
  private func eventHandler() -> String {
    var source = "window.dmpNativeBridge = {"
    source += "triggerEvent: function(data) {"

extension DMPlayerViewController: WKScriptMessageHandler {
 
  open func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
    if message.name == DMPlayerViewController.consoleHandlerEvent {
      print(message.body)
    } else {
      guard let event = EventParser.parseEvent(from: message.body) else { return }
      delegate?.player(self, didReceiveEvent: event)
    }
  }
  
}
