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.
@@ -725,24 +725,65 @@ function createHlsAdPlayer(contentVideo, options) {
725
725
  }
726
726
  }
727
727
  function fetchVastXml(vastTagUrl) {
728
+ var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
728
729
  return _async_to_generator(function() {
729
- var response;
730
+ var requestVast, response, error;
730
731
  return _ts_generator(this, function(_state) {
731
732
  switch(_state.label){
732
733
  case 0:
733
- return [
734
- 4,
735
- fetch(vastTagUrl, {
734
+ requestVast = function requestVast(creds) {
735
+ return fetch(vastTagUrl, {
736
736
  mode: "cors",
737
- credentials: "include",
737
+ credentials: creds,
738
738
  headers: {
739
739
  "Accept": "application/xml, text/xml, */*"
740
740
  },
741
741
  referrerPolicy: "no-referrer-when-downgrade"
742
- })
743
- ];
742
+ });
743
+ };
744
+ _state.label = 1;
744
745
  case 1:
746
+ _state.trys.push([
747
+ 1,
748
+ 3,
749
+ ,
750
+ 7
751
+ ]);
752
+ return [
753
+ 4,
754
+ requestVast(credentials)
755
+ ];
756
+ case 2:
745
757
  response = _state.sent();
758
+ return [
759
+ 3,
760
+ 7
761
+ ];
762
+ case 3:
763
+ error = _state.sent();
764
+ if (!(credentials !== "omit")) return [
765
+ 3,
766
+ 5
767
+ ];
768
+ console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
769
+ return [
770
+ 4,
771
+ requestVast("omit")
772
+ ];
773
+ case 4:
774
+ response = _state.sent();
775
+ return [
776
+ 3,
777
+ 6
778
+ ];
779
+ case 5:
780
+ throw error;
781
+ case 6:
782
+ return [
783
+ 3,
784
+ 7
785
+ ];
786
+ case 7:
746
787
  if (!response.ok) {
747
788
  throw new Error("Failed to fetch VAST: ".concat(response.statusText));
748
789
  }
@@ -764,7 +805,7 @@ function createHlsAdPlayer(contentVideo, options) {
764
805
  depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls();
765
806
  return [
766
807
  4,
767
- fetchVastXml(vastTagUrl)
808
+ fetchVastXml(vastTagUrl, depth === 0 ? "include" : "omit")
768
809
  ];
769
810
  case 1:
770
811
  vastXml = _state.sent();