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.
@@ -776,24 +776,65 @@ function createHlsAdPlayer(contentVideo, options) {
776
776
  }
777
777
  }
778
778
  function fetchVastXml(vastTagUrl) {
779
+ var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
779
780
  return _async_to_generator(function() {
780
- var response;
781
+ var requestVast, response, error;
781
782
  return _ts_generator(this, function(_state) {
782
783
  switch(_state.label){
783
784
  case 0:
784
- return [
785
- 4,
786
- fetch(vastTagUrl, {
785
+ requestVast = function requestVast(creds) {
786
+ return fetch(vastTagUrl, {
787
787
  mode: "cors",
788
- credentials: "include",
788
+ credentials: creds,
789
789
  headers: {
790
790
  "Accept": "application/xml, text/xml, */*"
791
791
  },
792
792
  referrerPolicy: "no-referrer-when-downgrade"
793
- })
794
- ];
793
+ });
794
+ };
795
+ _state.label = 1;
795
796
  case 1:
797
+ _state.trys.push([
798
+ 1,
799
+ 3,
800
+ ,
801
+ 7
802
+ ]);
803
+ return [
804
+ 4,
805
+ requestVast(credentials)
806
+ ];
807
+ case 2:
796
808
  response = _state.sent();
809
+ return [
810
+ 3,
811
+ 7
812
+ ];
813
+ case 3:
814
+ error = _state.sent();
815
+ if (!(credentials !== "omit")) return [
816
+ 3,
817
+ 5
818
+ ];
819
+ console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
820
+ return [
821
+ 4,
822
+ requestVast("omit")
823
+ ];
824
+ case 4:
825
+ response = _state.sent();
826
+ return [
827
+ 3,
828
+ 6
829
+ ];
830
+ case 5:
831
+ throw error;
832
+ case 6:
833
+ return [
834
+ 3,
835
+ 7
836
+ ];
837
+ case 7:
797
838
  if (!response.ok) {
798
839
  throw new Error("Failed to fetch VAST: ".concat(response.statusText));
799
840
  }
@@ -815,7 +856,7 @@ function createHlsAdPlayer(contentVideo, options) {
815
856
  depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls();
816
857
  return [
817
858
  4,
818
- fetchVastXml(vastTagUrl)
859
+ fetchVastXml(vastTagUrl, depth === 0 ? "include" : "omit")
819
860
  ];
820
861
  case 1:
821
862
  vastXml = _state.sent();