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.
@@ -762,24 +762,65 @@ function createHlsAdPlayer(contentVideo, options) {
762
762
  }
763
763
  }
764
764
  function fetchVastXml(vastTagUrl) {
765
+ var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
765
766
  return _async_to_generator(function() {
766
- var response;
767
+ var requestVast, response, error;
767
768
  return _ts_generator(this, function(_state) {
768
769
  switch(_state.label){
769
770
  case 0:
770
- return [
771
- 4,
772
- fetch(vastTagUrl, {
771
+ requestVast = function requestVast(creds) {
772
+ return fetch(vastTagUrl, {
773
773
  mode: "cors",
774
- credentials: "include",
774
+ credentials: creds,
775
775
  headers: {
776
776
  "Accept": "application/xml, text/xml, */*"
777
777
  },
778
778
  referrerPolicy: "no-referrer-when-downgrade"
779
- })
780
- ];
779
+ });
780
+ };
781
+ _state.label = 1;
781
782
  case 1:
783
+ _state.trys.push([
784
+ 1,
785
+ 3,
786
+ ,
787
+ 7
788
+ ]);
789
+ return [
790
+ 4,
791
+ requestVast(credentials)
792
+ ];
793
+ case 2:
794
+ response = _state.sent();
795
+ return [
796
+ 3,
797
+ 7
798
+ ];
799
+ case 3:
800
+ error = _state.sent();
801
+ if (!(credentials !== "omit")) return [
802
+ 3,
803
+ 5
804
+ ];
805
+ console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
806
+ return [
807
+ 4,
808
+ requestVast("omit")
809
+ ];
810
+ case 4:
782
811
  response = _state.sent();
812
+ return [
813
+ 3,
814
+ 6
815
+ ];
816
+ case 5:
817
+ throw error;
818
+ case 6:
819
+ return [
820
+ 3,
821
+ 7
822
+ ];
823
+ case 7:
783
824
  if (!response.ok) {
784
825
  throw new Error("Failed to fetch VAST: ".concat(response.statusText));
785
826
  }
@@ -801,7 +842,7 @@ function createHlsAdPlayer(contentVideo, options) {
801
842
  depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls();
802
843
  return [
803
844
  4,
804
- fetchVastXml(vastTagUrl)
845
+ fetchVastXml(vastTagUrl, depth === 0 ? "include" : "omit")
805
846
  ];
806
847
  case 1:
807
848
  vastXml = _state.sent();