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.cjs CHANGED
@@ -963,24 +963,65 @@ function createHlsAdPlayer(contentVideo, options) {
963
963
  }
964
964
  }
965
965
  function fetchVastXml(vastTagUrl) {
966
+ var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
966
967
  return _async_to_generator(function() {
967
- var response;
968
+ var requestVast, response, error;
968
969
  return _ts_generator(this, function(_state) {
969
970
  switch(_state.label){
970
971
  case 0:
971
- return [
972
- 4,
973
- fetch(vastTagUrl, {
972
+ requestVast = function requestVast(creds) {
973
+ return fetch(vastTagUrl, {
974
974
  mode: "cors",
975
- credentials: "include",
975
+ credentials: creds,
976
976
  headers: {
977
977
  "Accept": "application/xml, text/xml, */*"
978
978
  },
979
979
  referrerPolicy: "no-referrer-when-downgrade"
980
- })
981
- ];
980
+ });
981
+ };
982
+ _state.label = 1;
982
983
  case 1:
984
+ _state.trys.push([
985
+ 1,
986
+ 3,
987
+ ,
988
+ 7
989
+ ]);
990
+ return [
991
+ 4,
992
+ requestVast(credentials)
993
+ ];
994
+ case 2:
995
+ response = _state.sent();
996
+ return [
997
+ 3,
998
+ 7
999
+ ];
1000
+ case 3:
1001
+ error = _state.sent();
1002
+ if (!(credentials !== "omit")) return [
1003
+ 3,
1004
+ 5
1005
+ ];
1006
+ console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
1007
+ return [
1008
+ 4,
1009
+ requestVast("omit")
1010
+ ];
1011
+ case 4:
983
1012
  response = _state.sent();
1013
+ return [
1014
+ 3,
1015
+ 6
1016
+ ];
1017
+ case 5:
1018
+ throw error;
1019
+ case 6:
1020
+ return [
1021
+ 3,
1022
+ 7
1023
+ ];
1024
+ case 7:
984
1025
  if (!response.ok) {
985
1026
  throw new Error("Failed to fetch VAST: ".concat(response.statusText));
986
1027
  }
@@ -1002,7 +1043,7 @@ function createHlsAdPlayer(contentVideo, options) {
1002
1043
  depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls();
1003
1044
  return [
1004
1045
  4,
1005
- fetchVastXml(vastTagUrl)
1046
+ fetchVastXml(vastTagUrl, depth === 0 ? "include" : "omit")
1006
1047
  ];
1007
1048
  case 1:
1008
1049
  vastXml = _state.sent();