 extension DMPlayerViewController: WKNavigationDelegate {
   
   public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
-    self.loaded = true
+    isInitialized = true
     
-    if let loadVideoId = self.loadVideoId {
-      self.load(videoId: loadVideoId)
-      self.loadVideoId = nil
-    }
-  }
-  
-}
+    if let videoIdToLoad = videoIdToLoad {
+      load(videoId: videoIdToLoad)
+      self.videoIdToLoad = nil
+    }
+  }
+  
+}

  /// - Parameter videoId: The video's XID
  public func load(videoId: String) {
    assert(baseUrl != nil)
    if self.loaded {
      webView.evaluateJavaScript("player.load('\(videoId)')", completionHandler: nil)
    }
    else {
      self.loadVideoId = videoId
    }
  }
  
  private func newRequest(accessToken: String?, parameters: [String: Any]) -> URLRequest {

  fileprivate static let pathPrefix = "/embed/"
  private static let messageHandlerEvent = "triggerEvent"
  
  fileprivate var isInitialized = false
  fileprivate var videoIdToLoad: String?
  
  public weak var delegate: DMPlayerViewControllerDelegate?
  
