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.
package/lib/index.js CHANGED
@@ -746,24 +746,65 @@ function createHlsAdPlayer(contentVideo, options) {
746
746
  }
747
747
  }
748
748
  function fetchVastXml(vastTagUrl) {
749
+ var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
749
750
  return _async_to_generator(function() {
750
- var response;
751
+ var requestVast, response, error;
751
752
  return _ts_generator(this, function(_state) {
752
753
  switch(_state.label){
753
754
  case 0:
754
- return [
755
- 4,
756
- fetch(vastTagUrl, {
755
+ requestVast = function requestVast(creds) {
756
+ return fetch(vastTagUrl, {
757
757
  mode: "cors",
758
- credentials: "include",
758
+ credentials: creds,
759
759
  headers: {
760
760
  "Accept": "application/xml, text/xml, */*"
761
761
  },
762
762
  referrerPolicy: "no-referrer-when-downgrade"
763
- })
764
- ];
763
+ });
764
+ };
765
+ _state.label = 1;
765
766
  case 1:
767
+ _state.trys.push([
768
+ 1,
769
+ 3,
770
+ ,
771
+ 7
772
+ ]);
773
+ return [
774
+ 4,
775
+ requestVast(credentials)
776
+ ];
777
+ case 2:
778
+ response = _state.sent();
779
+ return [
780
+ 3,
781
+ 7
782
+ ];
783
+ case 3:
784
+ error = _state.sent();
785
+ if (!(credentials !== "omit")) return [
786
+ 3,
787
+ 5
788
+ ];
789
+ console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
790
+ return [
791
+ 4,
792
+ requestVast("omit")
793
+ ];
794
+ case 4:
766
795
  response = _state.sent();
796
+ return [
797
+ 3,
798
+ 6
799
+ ];
800
+ case 5:
801
+ throw error;
802
+ case 6:
803
+ return [
804
+ 3,
805
+ 7
806
+ ];
807
+ case 7:
767
808
  if (!response.ok) {
768
809
  throw new Error("Failed to fetch VAST: ".concat(response.statusText));
769
810
  }
@@ -785,7 +826,7 @@ function createHlsAdPlayer(contentVideo, options) {
785
826
  depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls();
786
827
  return [
787
828
  4,
788
- fetchVastXml(vastTagUrl)
829
+ fetchVastXml(vastTagUrl, depth === 0 ? "include" : "omit")
789
830
  ];
790
831
  case 1:
791
832
  vastXml = _state.sent();