stormcloud-video-player 0.8.30 → 0.8.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -812,24 +812,65 @@ function createHlsAdPlayer(contentVideo, options) {
812
812
  }
813
813
  }
814
814
  function fetchVastXml(vastTagUrl) {
815
+ var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
815
816
  return _async_to_generator(function() {
816
- var response;
817
+ var requestVast, response, error;
817
818
  return _ts_generator(this, function(_state) {
818
819
  switch(_state.label){
819
820
  case 0:
820
- return [
821
- 4,
822
- fetch(vastTagUrl, {
821
+ requestVast = function requestVast(creds) {
822
+ return fetch(vastTagUrl, {
823
823
  mode: "cors",
824
- credentials: "include",
824
+ credentials: creds,
825
825
  headers: {
826
826
  "Accept": "application/xml, text/xml, */*"
827
827
  },
828
828
  referrerPolicy: "no-referrer-when-downgrade"
829
- })
830
- ];
829
+ });
830
+ };
831
+ _state.label = 1;
831
832
  case 1:
833
+ _state.trys.push([
834
+ 1,
835
+ 3,
836
+ ,
837
+ 7
838
+ ]);
839
+ return [
840
+ 4,
841
+ requestVast(credentials)
842
+ ];
843
+ case 2:
832
844
  response = _state.sent();
845
+ return [
846
+ 3,
847
+ 7
848
+ ];
849
+ case 3:
850
+ error = _state.sent();
851
+ if (!(credentials !== "omit")) return [
852
+ 3,
853
+ 5
854
+ ];
855
+ console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
856
+ return [
857
+ 4,
858
+ requestVast("omit")
859
+ ];
860
+ case 4:
861
+ response = _state.sent();
862
+ return [
863
+ 3,
864
+ 6
865
+ ];
866
+ case 5:
867
+ throw error;
868
+ case 6:
869
+ return [
870
+ 3,
871
+ 7
872
+ ];
873
+ case 7:
833
874
  if (!response.ok) {
834
875
  throw new Error("Failed to fetch VAST: ".concat(response.statusText));
835
876
  }
@@ -851,7 +892,7 @@ function createHlsAdPlayer(contentVideo, options) {
851
892
  depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls();
852
893
  return [
853
894
  4,
854
- fetchVastXml(vastTagUrl)
895
+ fetchVastXml(vastTagUrl, depth === 0 ? "include" : "omit")
855
896
  ];
856
897
  case 1:
857
898
  vastXml = _state.sent();