       completion?()
       return
     }
-    
+
+    setConsentCookie()
+
     let js = buildLoadString(videoId: videoId, params: params)
     
     webView.evaluateJavaScript(js) { _,_ in

  fileprivate static let messageHandlerEvent = "triggerEvent"
  fileprivate static let consoleHandlerEvent = "consoleEvent"
  fileprivate static let loggerParameterKey = "logger"
  
  private var webView: WKWebView!
  private var baseUrl: URL!

      return nil
    }
  }

  private func setConsentCookie() {
    if let tcString = UserDefaults.standard.string(forKey: DMPlayerViewController.tcStringKey) {
      var cookieProperties: [HTTPCookiePropertyKey: Any] = [
        .name: DMPlayerViewController.tcStringCookieName,
        .value: tcString,
        .domain: "dailymotion.com",
        .path: "/",
        .secure: true
      ]
      if let expiresDate = Calendar.current.date(byAdding: .month, value: 6, to: Date()) {
        cookieProperties[.expires] = expiresDate
      }

      guard let cookie = HTTPCookie(properties: cookieProperties) else { return }

      HTTPCookieStorage.shared.setCookie(cookie)
    }
  }

}

