stormcloud-video-player 0.5.26 → 0.6.1

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
@@ -458,15 +458,15 @@ __export(index_exports, {
458
458
  canPlay: function canPlay1() {
459
459
  return canPlay;
460
460
  },
461
- createPrebidAdLayer: function createPrebidAdLayer1() {
462
- return createPrebidAdLayer;
463
- },
464
- createPrebidManager: function createPrebidManager1() {
465
- return createPrebidManager;
466
- },
467
461
  createStormcloudPlayer: function createStormcloudPlayer1() {
468
462
  return createStormcloudPlayer;
469
463
  },
464
+ createVastAdLayer: function createVastAdLayer1() {
465
+ return createVastAdLayer;
466
+ },
467
+ createVastManager: function createVastManager1() {
468
+ return createVastManager;
469
+ },
470
470
  default: function _default() {
471
471
  return StormcloudVideoPlayerComponent;
472
472
  },
@@ -530,362 +530,6 @@ module.exports = __toCommonJS(index_exports);
530
530
  var import_react = __toESM(require("react"), 1);
531
531
  // src/player/StormcloudVideoPlayer.ts
532
532
  var import_hls2 = __toESM(require("hls.js"), 1);
533
- // src/sdk/prebid.ts
534
- var DEFAULT_TIMEOUT_MS = 3e3;
535
- var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
536
- function createPrebidManager() {
537
- var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
538
- var _options_debug;
539
- var initialized = false;
540
- var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
541
- function log() {
542
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
543
- args[_key] = arguments[_key];
544
- }
545
- if (debug) {
546
- var _console;
547
- (_console = console).log.apply(_console, [
548
- "[Prebid]"
549
- ].concat(_to_consumable_array(args)));
550
- }
551
- }
552
- function warn() {
553
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
554
- args[_key] = arguments[_key];
555
- }
556
- var _console;
557
- (_console = console).warn.apply(_console, [
558
- "[Prebid]"
559
- ].concat(_to_consumable_array(args)));
560
- }
561
- function parseResponse(data) {
562
- var bids = [];
563
- var seatbids = (data === null || data === void 0 ? void 0 : data.seatbid) || [];
564
- var currency = (data === null || data === void 0 ? void 0 : data.cur) || "USD";
565
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
566
- try {
567
- for(var _iterator = seatbids[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
568
- var seatbid = _step.value;
569
- var seat = seatbid.seat || "unknown";
570
- var bidArray = seatbid.bid || [];
571
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
572
- try {
573
- for(var _iterator1 = bidArray[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
574
- var bid = _step1.value;
575
- var _bid_ext_prebid_cache_vastXml, _bid_ext_prebid_cache, _bid_ext_prebid, _bid_ext;
576
- var cacheUrl = (_bid_ext = bid.ext) === null || _bid_ext === void 0 ? void 0 : (_bid_ext_prebid = _bid_ext.prebid) === null || _bid_ext_prebid === void 0 ? void 0 : (_bid_ext_prebid_cache = _bid_ext_prebid.cache) === null || _bid_ext_prebid_cache === void 0 ? void 0 : (_bid_ext_prebid_cache_vastXml = _bid_ext_prebid_cache.vastXml) === null || _bid_ext_prebid_cache_vastXml === void 0 ? void 0 : _bid_ext_prebid_cache_vastXml.url;
577
- var vastXml = bid.adm || void 0;
578
- var bidResponse = {
579
- bidder: seat,
580
- cpm: bid.price || 0,
581
- width: bid.w || 0,
582
- height: bid.h || 0,
583
- adId: bid.id || "",
584
- impId: bid.impid || "",
585
- creativeId: bid.crid || "",
586
- currency: currency
587
- };
588
- if (cacheUrl) bidResponse.vastUrl = cacheUrl;
589
- if (vastXml) bidResponse.vastXml = vastXml;
590
- if (bid.adomain) bidResponse.adomain = bid.adomain;
591
- bids.push(bidResponse);
592
- }
593
- } catch (err) {
594
- _didIteratorError1 = true;
595
- _iteratorError1 = err;
596
- } finally{
597
- try {
598
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
599
- _iterator1.return();
600
- }
601
- } finally{
602
- if (_didIteratorError1) {
603
- throw _iteratorError1;
604
- }
605
- }
606
- }
607
- }
608
- } catch (err) {
609
- _didIteratorError = true;
610
- _iteratorError = err;
611
- } finally{
612
- try {
613
- if (!_iteratorNormalCompletion && _iterator.return != null) {
614
- _iterator.return();
615
- }
616
- } finally{
617
- if (_didIteratorError) {
618
- throw _iteratorError;
619
- }
620
- }
621
- }
622
- bids.sort(function(a, b) {
623
- return b.cpm - a.cpm;
624
- });
625
- return bids;
626
- }
627
- function initialize() {
628
- return _async_to_generator(function() {
629
- return _ts_generator(this, function(_state) {
630
- if (initialized) return [
631
- 2
632
- ];
633
- initialized = true;
634
- log("Initialized, auction URL:", AUCTION_URL);
635
- return [
636
- 2
637
- ];
638
- });
639
- })();
640
- }
641
- function requestBids(context) {
642
- return _async_to_generator(function() {
643
- var timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, body, response, body1, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
644
- return _ts_generator(this, function(_state) {
645
- switch(_state.label){
646
- case 0:
647
- if (!initialized) {
648
- throw new Error("Prebid not initialized. Call initialize() first.");
649
- }
650
- timeout = DEFAULT_TIMEOUT_MS;
651
- log("Fetching auction response from:", AUCTION_URL);
652
- controller = typeof AbortController !== "undefined" ? new AbortController() : null;
653
- timeoutId = setTimeout(function() {
654
- controller === null || controller === void 0 ? void 0 : controller.abort();
655
- }, timeout + 2e3);
656
- _state.label = 1;
657
- case 1:
658
- _state.trys.push([
659
- 1,
660
- 6,
661
- ,
662
- 7
663
- ]);
664
- fetchOptions = {
665
- method: "POST"
666
- };
667
- if (controller) {
668
- fetchOptions.signal = controller.signal;
669
- }
670
- if ((context === null || context === void 0 ? void 0 : context.remainingBreakSec) != null) {
671
- body = {
672
- imp: [
673
- {
674
- video: {
675
- maxduration: Math.floor(context.remainingBreakSec)
676
- }
677
- }
678
- ]
679
- };
680
- fetchOptions.body = JSON.stringify(body);
681
- fetchOptions.headers = {
682
- "Content-Type": "application/json"
683
- };
684
- log("Sending context to auction: maxduration=", Math.floor(context.remainingBreakSec));
685
- }
686
- return [
687
- 4,
688
- fetch(AUCTION_URL, fetchOptions)
689
- ];
690
- case 2:
691
- response = _state.sent();
692
- clearTimeout(timeoutId);
693
- if (!!response.ok) return [
694
- 3,
695
- 4
696
- ];
697
- return [
698
- 4,
699
- response.text().catch(function() {
700
- return "";
701
- })
702
- ];
703
- case 3:
704
- body1 = _state.sent();
705
- throw new Error("Prebid Server returned HTTP ".concat(response.status, ": ").concat(body1.slice(0, 200)));
706
- case 4:
707
- return [
708
- 4,
709
- response.json()
710
- ];
711
- case 5:
712
- data = _state.sent();
713
- if (debug && (data === null || data === void 0 ? void 0 : (_data_ext = data.ext) === null || _data_ext === void 0 ? void 0 : _data_ext.responsetimemillis)) {
714
- log("Bidder response times:", data.ext.responsetimemillis);
715
- }
716
- if (debug && (data === null || data === void 0 ? void 0 : (_data_ext1 = data.ext) === null || _data_ext1 === void 0 ? void 0 : _data_ext1.errors)) {
717
- warn("Auction errors:", data.ext.errors);
718
- }
719
- bids = parseResponse(data);
720
- log("Received ".concat(bids.length, " bid(s)"));
721
- if (debug) {
722
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
723
- try {
724
- for(_iterator = bids[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
725
- b = _step.value;
726
- log(" ".concat(b.bidder, ": $").concat(b.cpm.toFixed(2), " ").concat(b.currency, " ").concat(b.width, "x").concat(b.height) + (b.vastUrl ? " [cached VAST]" : "") + (b.vastXml && !b.vastUrl ? " [VAST XML]" : ""));
727
- }
728
- } catch (err) {
729
- _didIteratorError = true;
730
- _iteratorError = err;
731
- } finally{
732
- try {
733
- if (!_iteratorNormalCompletion && _iterator.return != null) {
734
- _iterator.return();
735
- }
736
- } finally{
737
- if (_didIteratorError) {
738
- throw _iteratorError;
739
- }
740
- }
741
- }
742
- }
743
- return [
744
- 2,
745
- bids
746
- ];
747
- case 6:
748
- error = _state.sent();
749
- clearTimeout(timeoutId);
750
- if ((error === null || error === void 0 ? void 0 : error.name) === "AbortError") {
751
- warn("Auction request timed out after ".concat(timeout + 2e3, "ms"));
752
- return [
753
- 2,
754
- []
755
- ];
756
- }
757
- throw error;
758
- case 7:
759
- return [
760
- 2
761
- ];
762
- }
763
- });
764
- })();
765
- }
766
- var REQUEST_BIDS_MAX_RETRIES = 3;
767
- var REQUEST_BIDS_BACKOFF_MS = 1500;
768
- function requestBidsUntilResponse(context) {
769
- return _async_to_generator(function() {
770
- var _loop, lastError, attempt, _ret;
771
- return _ts_generator(this, function(_state) {
772
- switch(_state.label){
773
- case 0:
774
- _loop = function(attempt) {
775
- var bids, err, delay;
776
- return _ts_generator(this, function(_state) {
777
- switch(_state.label){
778
- case 0:
779
- _state.trys.push([
780
- 0,
781
- 2,
782
- ,
783
- 3
784
- ]);
785
- return [
786
- 4,
787
- requestBids(context)
788
- ];
789
- case 1:
790
- bids = _state.sent();
791
- if (bids.length > 0) {
792
- log("requestBidsUntilResponse: got ".concat(bids.length, " bid(s) on attempt ").concat(attempt));
793
- return [
794
- 2,
795
- {
796
- v: bids
797
- }
798
- ];
799
- }
800
- log("requestBidsUntilResponse: no bids on attempt ".concat(attempt, "/").concat(REQUEST_BIDS_MAX_RETRIES));
801
- return [
802
- 3,
803
- 3
804
- ];
805
- case 2:
806
- err = _state.sent();
807
- lastError = err;
808
- warn("requestBidsUntilResponse: attempt ".concat(attempt, "/").concat(REQUEST_BIDS_MAX_RETRIES, " failed:"), err);
809
- return [
810
- 3,
811
- 3
812
- ];
813
- case 3:
814
- if (!(attempt < REQUEST_BIDS_MAX_RETRIES)) return [
815
- 3,
816
- 5
817
- ];
818
- delay = REQUEST_BIDS_BACKOFF_MS * attempt;
819
- log("requestBidsUntilResponse: waiting ".concat(delay, "ms before retry"));
820
- return [
821
- 4,
822
- new Promise(function(resolve) {
823
- return setTimeout(resolve, delay);
824
- })
825
- ];
826
- case 4:
827
- _state.sent();
828
- _state.label = 5;
829
- case 5:
830
- return [
831
- 2
832
- ];
833
- }
834
- });
835
- };
836
- if (!initialized) {
837
- throw new Error("Prebid not initialized. Call initialize() first.");
838
- }
839
- attempt = 1;
840
- _state.label = 1;
841
- case 1:
842
- if (!(attempt <= REQUEST_BIDS_MAX_RETRIES)) return [
843
- 3,
844
- 4
845
- ];
846
- return [
847
- 5,
848
- _ts_values(_loop(attempt))
849
- ];
850
- case 2:
851
- _ret = _state.sent();
852
- if (_type_of(_ret) === "object") return [
853
- 2,
854
- _ret.v
855
- ];
856
- _state.label = 3;
857
- case 3:
858
- attempt++;
859
- return [
860
- 3,
861
- 1
862
- ];
863
- case 4:
864
- if (_instanceof(lastError, Error)) {
865
- throw lastError;
866
- }
867
- return [
868
- 2,
869
- []
870
- ];
871
- }
872
- });
873
- })();
874
- }
875
- function destroy() {
876
- initialized = false;
877
- log("Destroyed");
878
- }
879
- return {
880
- initialize: initialize,
881
- requestBids: requestBids,
882
- requestBidsUntilResponse: requestBidsUntilResponse,
883
- destroy: destroy,
884
- get isInitialized () {
885
- return initialized;
886
- }
887
- };
888
- }
889
533
  // src/sdk/vastParser.ts
890
534
  function isHlsType(type) {
891
535
  return type === "application/x-mpegURL" || type.includes("m3u8");
@@ -1184,11 +828,271 @@ function fireTrackingPixels(urls, sessionId) {
1184
828
  } catch (error) {
1185
829
  console.warn("".concat(logPrefix, " Error firing tracking pixel:"), error);
1186
830
  }
1187
- });
831
+ });
832
+ }
833
+ // src/sdk/vastManager.ts
834
+ var VAST_TAG_URL = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21821455290/Airy-Android&description_url=http%3A%2F%2Fairy.tv&tfcd=0&npa=0&sz=1x1%7C300x250%7C400x300%7C640x480&gdfp_req=1&unviewed_position_start=1&correlator=[placeholder]&vpos=preroll&output=vast&env=vp&vpmute=0&vpa=click";
835
+ var DEFAULT_TIMEOUT_MS = 5e3;
836
+ var MAX_RETRIES = 3;
837
+ var RETRY_BACKOFF_MS = 1500;
838
+ function createVastManager() {
839
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
840
+ var _options_debug;
841
+ var initialized = false;
842
+ var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
843
+ function log() {
844
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
845
+ args[_key] = arguments[_key];
846
+ }
847
+ if (debug) {
848
+ var _console;
849
+ (_console = console).log.apply(_console, [
850
+ "[VastManager]"
851
+ ].concat(_to_consumable_array(args)));
852
+ }
853
+ }
854
+ function warn() {
855
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
856
+ args[_key] = arguments[_key];
857
+ }
858
+ var _console;
859
+ (_console = console).warn.apply(_console, [
860
+ "[VastManager]"
861
+ ].concat(_to_consumable_array(args)));
862
+ }
863
+ function initialize() {
864
+ return _async_to_generator(function() {
865
+ return _ts_generator(this, function(_state) {
866
+ if (initialized) return [
867
+ 2
868
+ ];
869
+ initialized = true;
870
+ log("Initialized, VAST tag URL:", VAST_TAG_URL.split("?")[0]);
871
+ return [
872
+ 2
873
+ ];
874
+ });
875
+ })();
876
+ }
877
+ function requestBids(_context) {
878
+ return _async_to_generator(function() {
879
+ var correlator, url, controller, timeoutId, _ref, _ref1, _vastAd_mediaFiles_, _vastAd_mediaFiles_1, fetchOptions, response, vastXml, vastAd, bid, error;
880
+ return _ts_generator(this, function(_state) {
881
+ switch(_state.label){
882
+ case 0:
883
+ if (!initialized) {
884
+ throw new Error("VastManager not initialized. Call initialize() first.");
885
+ }
886
+ correlator = Math.floor(Math.random() * 1e12).toString();
887
+ url = VAST_TAG_URL.replace("[placeholder]", correlator);
888
+ log("Fetching VAST tag, correlator:", correlator);
889
+ controller = typeof AbortController !== "undefined" ? new AbortController() : null;
890
+ timeoutId = setTimeout(function() {
891
+ return controller === null || controller === void 0 ? void 0 : controller.abort();
892
+ }, DEFAULT_TIMEOUT_MS);
893
+ _state.label = 1;
894
+ case 1:
895
+ _state.trys.push([
896
+ 1,
897
+ 4,
898
+ ,
899
+ 5
900
+ ]);
901
+ fetchOptions = {
902
+ method: "GET",
903
+ mode: "cors",
904
+ credentials: "omit",
905
+ headers: {
906
+ Accept: "application/xml, text/xml, */*"
907
+ },
908
+ referrerPolicy: "no-referrer-when-downgrade"
909
+ };
910
+ if (controller) fetchOptions.signal = controller.signal;
911
+ return [
912
+ 4,
913
+ fetch(url, fetchOptions)
914
+ ];
915
+ case 2:
916
+ response = _state.sent();
917
+ clearTimeout(timeoutId);
918
+ if (!response.ok) {
919
+ throw new Error("VAST request returned HTTP ".concat(response.status));
920
+ }
921
+ return [
922
+ 4,
923
+ response.text()
924
+ ];
925
+ case 3:
926
+ vastXml = _state.sent();
927
+ log("VAST XML received, length:", vastXml.length);
928
+ vastAd = parseVastXml(vastXml, "mp4-first", "[VastManager]");
929
+ if (!vastAd) {
930
+ log("VAST parsed but no usable ad found");
931
+ return [
932
+ 2,
933
+ []
934
+ ];
935
+ }
936
+ log("Ad parsed: id=".concat(vastAd.id, ", duration=").concat(vastAd.duration, "s, mediaFiles=").concat(vastAd.mediaFiles.length));
937
+ bid = {
938
+ bidder: "vast-direct",
939
+ cpm: 0,
940
+ vastXml: vastXml,
941
+ width: (_ref = (_vastAd_mediaFiles_ = vastAd.mediaFiles[0]) === null || _vastAd_mediaFiles_ === void 0 ? void 0 : _vastAd_mediaFiles_.width) !== null && _ref !== void 0 ? _ref : 0,
942
+ height: (_ref1 = (_vastAd_mediaFiles_1 = vastAd.mediaFiles[0]) === null || _vastAd_mediaFiles_1 === void 0 ? void 0 : _vastAd_mediaFiles_1.height) !== null && _ref1 !== void 0 ? _ref1 : 0,
943
+ adId: vastAd.id,
944
+ impId: correlator,
945
+ creativeId: vastAd.id,
946
+ currency: "USD",
947
+ durationSec: vastAd.duration
948
+ };
949
+ return [
950
+ 2,
951
+ [
952
+ bid
953
+ ]
954
+ ];
955
+ case 4:
956
+ error = _state.sent();
957
+ clearTimeout(timeoutId);
958
+ if ((error === null || error === void 0 ? void 0 : error.name) === "AbortError") {
959
+ warn("VAST request timed out after ".concat(DEFAULT_TIMEOUT_MS, "ms"));
960
+ return [
961
+ 2,
962
+ []
963
+ ];
964
+ }
965
+ throw error;
966
+ case 5:
967
+ return [
968
+ 2
969
+ ];
970
+ }
971
+ });
972
+ })();
973
+ }
974
+ function requestBidsUntilResponse(context) {
975
+ return _async_to_generator(function() {
976
+ var _loop, lastError, attempt, _ret;
977
+ return _ts_generator(this, function(_state) {
978
+ switch(_state.label){
979
+ case 0:
980
+ _loop = function(attempt) {
981
+ var bids, err, delay;
982
+ return _ts_generator(this, function(_state) {
983
+ switch(_state.label){
984
+ case 0:
985
+ _state.trys.push([
986
+ 0,
987
+ 2,
988
+ ,
989
+ 3
990
+ ]);
991
+ return [
992
+ 4,
993
+ requestBids(context)
994
+ ];
995
+ case 1:
996
+ bids = _state.sent();
997
+ if (bids.length > 0) {
998
+ log("requestBidsUntilResponse: got ".concat(bids.length, " ad(s) on attempt ").concat(attempt));
999
+ return [
1000
+ 2,
1001
+ {
1002
+ v: bids
1003
+ }
1004
+ ];
1005
+ }
1006
+ log("requestBidsUntilResponse: no ads on attempt ".concat(attempt, "/").concat(MAX_RETRIES));
1007
+ return [
1008
+ 3,
1009
+ 3
1010
+ ];
1011
+ case 2:
1012
+ err = _state.sent();
1013
+ lastError = err;
1014
+ warn("requestBidsUntilResponse: attempt ".concat(attempt, "/").concat(MAX_RETRIES, " failed:"), err);
1015
+ return [
1016
+ 3,
1017
+ 3
1018
+ ];
1019
+ case 3:
1020
+ if (!(attempt < MAX_RETRIES)) return [
1021
+ 3,
1022
+ 5
1023
+ ];
1024
+ delay = RETRY_BACKOFF_MS * attempt;
1025
+ log("requestBidsUntilResponse: waiting ".concat(delay, "ms before retry"));
1026
+ return [
1027
+ 4,
1028
+ new Promise(function(resolve) {
1029
+ return setTimeout(resolve, delay);
1030
+ })
1031
+ ];
1032
+ case 4:
1033
+ _state.sent();
1034
+ _state.label = 5;
1035
+ case 5:
1036
+ return [
1037
+ 2
1038
+ ];
1039
+ }
1040
+ });
1041
+ };
1042
+ if (!initialized) {
1043
+ throw new Error("VastManager not initialized. Call initialize() first.");
1044
+ }
1045
+ attempt = 1;
1046
+ _state.label = 1;
1047
+ case 1:
1048
+ if (!(attempt <= MAX_RETRIES)) return [
1049
+ 3,
1050
+ 4
1051
+ ];
1052
+ return [
1053
+ 5,
1054
+ _ts_values(_loop(attempt))
1055
+ ];
1056
+ case 2:
1057
+ _ret = _state.sent();
1058
+ if (_type_of(_ret) === "object") return [
1059
+ 2,
1060
+ _ret.v
1061
+ ];
1062
+ _state.label = 3;
1063
+ case 3:
1064
+ attempt++;
1065
+ return [
1066
+ 3,
1067
+ 1
1068
+ ];
1069
+ case 4:
1070
+ if (_instanceof(lastError, Error)) throw lastError;
1071
+ return [
1072
+ 2,
1073
+ []
1074
+ ];
1075
+ }
1076
+ });
1077
+ })();
1078
+ }
1079
+ function destroy() {
1080
+ initialized = false;
1081
+ log("Destroyed");
1082
+ }
1083
+ return {
1084
+ initialize: initialize,
1085
+ requestBids: requestBids,
1086
+ requestBidsUntilResponse: requestBidsUntilResponse,
1087
+ destroy: destroy,
1088
+ get isInitialized () {
1089
+ return initialized;
1090
+ }
1091
+ };
1188
1092
  }
1189
- // src/sdk/prebidAdLayer.ts
1093
+ // src/sdk/vastAdLayer.ts
1190
1094
  var import_hls = __toESM(require("hls.js"), 1);
1191
- var LOG = "[PrebidAdLayer]";
1095
+ var LOG = "[VastAdLayer]";
1192
1096
  function resolveBidToVastAd(winner, logPrefix) {
1193
1097
  if (winner.vastXml) {
1194
1098
  var ad = parseVastXml(winner.vastXml, "mp4-first", logPrefix);
@@ -1199,15 +1103,17 @@ function resolveBidToVastAd(winner, logPrefix) {
1199
1103
  }
1200
1104
  return Promise.resolve(null);
1201
1105
  }
1202
- function createPrebidAdLayer(contentVideo, options) {
1203
- var _ref, _ref1;
1106
+ function createVastAdLayer(contentVideo, options) {
1107
+ var _ref, _ref1, _ref2, _ref3;
1204
1108
  var adPlaying = false;
1205
1109
  var originalMutedState = false;
1206
1110
  var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
1207
1111
  var listeners = /* @__PURE__ */ new Map();
1208
1112
  var mainHlsInstance = options === null || options === void 0 ? void 0 : options.mainHlsInstance;
1209
1113
  var continueLiveStreamDuringAds = (_ref = options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) !== null && _ref !== void 0 ? _ref : false;
1210
- var debug = (_ref1 = options === null || options === void 0 ? void 0 : options.debug) !== null && _ref1 !== void 0 ? _ref1 : false;
1114
+ var smartTVMode = (_ref1 = options === null || options === void 0 ? void 0 : options.smartTVMode) !== null && _ref1 !== void 0 ? _ref1 : false;
1115
+ var singleElementMode = (_ref2 = options === null || options === void 0 ? void 0 : options.singleElementMode) !== null && _ref2 !== void 0 ? _ref2 : false;
1116
+ var debug = (_ref3 = options === null || options === void 0 ? void 0 : options.debug) !== null && _ref3 !== void 0 ? _ref3 : false;
1211
1117
  var adVideoElement;
1212
1118
  var adHls;
1213
1119
  var adContainerEl;
@@ -1216,6 +1122,7 @@ function createPrebidAdLayer(contentVideo, options) {
1216
1122
  var destroyed = false;
1217
1123
  var tornDown = false;
1218
1124
  var trackingFired = createEmptyTrackingState();
1125
+ var currentAdEventHandlers;
1219
1126
  var preloadSlots = /* @__PURE__ */ new Map();
1220
1127
  function emit(event, payload) {
1221
1128
  var set = listeners.get(event);
@@ -1318,63 +1225,86 @@ function createPrebidAdLayer(contentVideo, options) {
1318
1225
  video.volume = 1;
1319
1226
  return video;
1320
1227
  }
1228
+ function removeAdEventListeners() {
1229
+ if (!currentAdEventHandlers || !adVideoElement) return;
1230
+ var el = adVideoElement;
1231
+ el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
1232
+ el.removeEventListener("playing", currentAdEventHandlers.playing);
1233
+ el.removeEventListener("ended", currentAdEventHandlers.ended);
1234
+ el.removeEventListener("error", currentAdEventHandlers.error);
1235
+ el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
1236
+ el.removeEventListener("pause", currentAdEventHandlers.pause);
1237
+ el.removeEventListener("play", currentAdEventHandlers.play);
1238
+ currentAdEventHandlers = void 0;
1239
+ }
1321
1240
  function setupAdEventListeners() {
1322
1241
  if (!adVideoElement) return;
1323
- adVideoElement.addEventListener("timeupdate", function() {
1324
- var ad = currentAd;
1325
- if (!ad || !adVideoElement) return;
1326
- var progress = adVideoElement.currentTime / ad.duration;
1327
- if (progress >= 0.25 && !trackingFired.firstQuartile) {
1328
- trackingFired.firstQuartile = true;
1329
- fireTrackingPixels2(ad.trackingUrls.firstQuartile);
1330
- }
1331
- if (progress >= 0.5 && !trackingFired.midpoint) {
1332
- trackingFired.midpoint = true;
1333
- fireTrackingPixels2(ad.trackingUrls.midpoint);
1334
- }
1335
- if (progress >= 0.75 && !trackingFired.thirdQuartile) {
1336
- trackingFired.thirdQuartile = true;
1337
- fireTrackingPixels2(ad.trackingUrls.thirdQuartile);
1338
- }
1339
- });
1340
- adVideoElement.addEventListener("playing", function() {
1341
- var ad = currentAd;
1342
- if (!ad || trackingFired.start) return;
1343
- trackingFired.start = true;
1344
- fireTrackingPixels2(ad.trackingUrls.start);
1345
- if (debug) console.log("".concat(LOG, " Ad started playing"));
1346
- });
1347
- adVideoElement.addEventListener("ended", function() {
1348
- if (tornDown || !currentAd || trackingFired.complete) return;
1349
- trackingFired.complete = true;
1350
- fireTrackingPixels2(currentAd.trackingUrls.complete);
1351
- if (debug) console.log("".concat(LOG, " Ad completed"));
1352
- handleAdComplete();
1353
- });
1354
- adVideoElement.addEventListener("error", function(e) {
1355
- if (tornDown) return;
1356
- console.error("".concat(LOG, " Ad video error:"), e);
1357
- if (currentAd) fireTrackingPixels2(currentAd.trackingUrls.error);
1358
- handleAdError();
1359
- });
1360
- adVideoElement.addEventListener("volumechange", function() {
1361
- if (!currentAd || !adVideoElement) return;
1362
- if (adVideoElement.muted) {
1363
- fireTrackingPixels2(currentAd.trackingUrls.mute);
1364
- } else {
1365
- fireTrackingPixels2(currentAd.trackingUrls.unmute);
1366
- }
1367
- });
1368
- adVideoElement.addEventListener("pause", function() {
1369
- if (currentAd && adVideoElement && !adVideoElement.ended) {
1370
- fireTrackingPixels2(currentAd.trackingUrls.pause);
1371
- }
1372
- });
1373
- adVideoElement.addEventListener("play", function() {
1374
- if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
1375
- fireTrackingPixels2(currentAd.trackingUrls.resume);
1242
+ removeAdEventListeners();
1243
+ var handlers = {
1244
+ timeupdate: function timeupdate() {
1245
+ var ad = currentAd;
1246
+ if (!ad || !adVideoElement) return;
1247
+ var progress = adVideoElement.currentTime / ad.duration;
1248
+ if (progress >= 0.25 && !trackingFired.firstQuartile) {
1249
+ trackingFired.firstQuartile = true;
1250
+ fireTrackingPixels2(ad.trackingUrls.firstQuartile);
1251
+ }
1252
+ if (progress >= 0.5 && !trackingFired.midpoint) {
1253
+ trackingFired.midpoint = true;
1254
+ fireTrackingPixels2(ad.trackingUrls.midpoint);
1255
+ }
1256
+ if (progress >= 0.75 && !trackingFired.thirdQuartile) {
1257
+ trackingFired.thirdQuartile = true;
1258
+ fireTrackingPixels2(ad.trackingUrls.thirdQuartile);
1259
+ }
1260
+ },
1261
+ playing: function playing() {
1262
+ var ad = currentAd;
1263
+ if (!ad || trackingFired.start) return;
1264
+ trackingFired.start = true;
1265
+ fireTrackingPixels2(ad.trackingUrls.start);
1266
+ if (debug) console.log("".concat(LOG, " Ad started playing"));
1267
+ },
1268
+ ended: function ended() {
1269
+ if (tornDown || !currentAd || trackingFired.complete) return;
1270
+ trackingFired.complete = true;
1271
+ fireTrackingPixels2(currentAd.trackingUrls.complete);
1272
+ if (debug) console.log("".concat(LOG, " Ad completed"));
1273
+ handleAdComplete();
1274
+ },
1275
+ error: function error(e) {
1276
+ if (tornDown) return;
1277
+ console.error("".concat(LOG, " Ad video error:"), e);
1278
+ if (currentAd) fireTrackingPixels2(currentAd.trackingUrls.error);
1279
+ handleAdError();
1280
+ },
1281
+ volumechange: function volumechange() {
1282
+ if (!currentAd || !adVideoElement) return;
1283
+ if (adVideoElement.muted) {
1284
+ fireTrackingPixels2(currentAd.trackingUrls.mute);
1285
+ } else {
1286
+ fireTrackingPixels2(currentAd.trackingUrls.unmute);
1287
+ }
1288
+ },
1289
+ pause: function pause() {
1290
+ if (currentAd && adVideoElement && !adVideoElement.ended) {
1291
+ fireTrackingPixels2(currentAd.trackingUrls.pause);
1292
+ }
1293
+ },
1294
+ play: function play() {
1295
+ if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
1296
+ fireTrackingPixels2(currentAd.trackingUrls.resume);
1297
+ }
1376
1298
  }
1377
- });
1299
+ };
1300
+ adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
1301
+ adVideoElement.addEventListener("playing", handlers.playing);
1302
+ adVideoElement.addEventListener("ended", handlers.ended);
1303
+ adVideoElement.addEventListener("error", handlers.error);
1304
+ adVideoElement.addEventListener("volumechange", handlers.volumechange);
1305
+ adVideoElement.addEventListener("pause", handlers.pause);
1306
+ adVideoElement.addEventListener("play", handlers.play);
1307
+ currentAdEventHandlers = handlers;
1378
1308
  }
1379
1309
  function setAdPlayingFlag(isPlaying) {
1380
1310
  if (isPlaying) {
@@ -1397,6 +1327,7 @@ function createPrebidAdLayer(contentVideo, options) {
1397
1327
  }
1398
1328
  function handleAdError() {
1399
1329
  if (tornDown) return;
1330
+ if (!adPlaying) return;
1400
1331
  if (debug) console.log("".concat(LOG, " Handling ad error"));
1401
1332
  adPlaying = false;
1402
1333
  setAdPlayingFlag(false);
@@ -1407,14 +1338,19 @@ function createPrebidAdLayer(contentVideo, options) {
1407
1338
  emit("ad_error");
1408
1339
  }
1409
1340
  function teardownCurrentPlayback() {
1341
+ removeAdEventListeners();
1410
1342
  if (adHls) {
1411
1343
  adHls.destroy();
1412
1344
  adHls = void 0;
1413
1345
  }
1414
1346
  if (adVideoElement) {
1415
- adVideoElement.pause();
1416
- adVideoElement.removeAttribute("src");
1417
- adVideoElement.load();
1347
+ if (singleElementMode && adVideoElement === contentVideo) {
1348
+ contentVideo.pause();
1349
+ } else {
1350
+ adVideoElement.pause();
1351
+ adVideoElement.removeAttribute("src");
1352
+ adVideoElement.load();
1353
+ }
1418
1354
  }
1419
1355
  }
1420
1356
  function startNativePlayback(mediaFile) {
@@ -1447,8 +1383,17 @@ function createPrebidAdLayer(contentVideo, options) {
1447
1383
  handleAdError();
1448
1384
  });
1449
1385
  });
1386
+ var nonFatalNetworkErrors = 0;
1450
1387
  adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
1451
- if (data.fatal) handleAdError();
1388
+ if (data.fatal) {
1389
+ handleAdError();
1390
+ } else if (data.type === import_hls.default.ErrorTypes.NETWORK_ERROR) {
1391
+ nonFatalNetworkErrors++;
1392
+ if (nonFatalNetworkErrors >= 3) {
1393
+ if (debug) console.warn("".concat(LOG, " Too many non-fatal HLS network errors (").concat(nonFatalNetworkErrors, "), treating as fatal"));
1394
+ handleAdError();
1395
+ }
1396
+ }
1452
1397
  });
1453
1398
  } else if (adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
1454
1399
  adVideoElement.src = mediaFile.url;
@@ -1471,7 +1416,7 @@ function createPrebidAdLayer(contentVideo, options) {
1471
1416
  }
1472
1417
  function playAd(bids) {
1473
1418
  return _async_to_generator(function() {
1474
- var winner, ad, _contentVideo_parentElement, container, contentVolume, adVolume, mediaFile;
1419
+ var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
1475
1420
  return _ts_generator(this, function(_state) {
1476
1421
  switch(_state.label){
1477
1422
  case 0:
@@ -1513,32 +1458,40 @@ function createPrebidAdLayer(contentVideo, options) {
1513
1458
  trackingFired = _object_spread({}, createEmptyTrackingState());
1514
1459
  fireTrackingPixels2(ad.trackingUrls.impression);
1515
1460
  trackingFired.impression = true;
1516
- if (!adContainerEl) {
1517
- ;
1518
- container = document.createElement("div");
1519
- container.style.position = "absolute";
1520
- container.style.left = "0";
1521
- container.style.top = "0";
1522
- container.style.right = "0";
1523
- container.style.bottom = "0";
1524
- container.style.display = "none";
1525
- container.style.alignItems = "center";
1526
- container.style.justifyContent = "center";
1527
- container.style.pointerEvents = "none";
1528
- container.style.zIndex = "10";
1529
- container.style.backgroundColor = "#000";
1530
- (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1531
- adContainerEl = container;
1532
- }
1533
- if (!adVideoElement) {
1534
- adVideoElement = createAdVideoElement();
1535
- adContainerEl.appendChild(adVideoElement);
1461
+ contentVolume = contentVideo.volume;
1462
+ originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1463
+ if (singleElementMode) {
1464
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1465
+ teardownCurrentPlayback();
1466
+ adVideoElement = contentVideo;
1467
+ adHls = void 0;
1536
1468
  setupAdEventListeners();
1537
1469
  } else {
1538
- teardownCurrentPlayback();
1470
+ if (!adContainerEl) {
1471
+ ;
1472
+ container = document.createElement("div");
1473
+ container.style.position = "absolute";
1474
+ container.style.left = "0";
1475
+ container.style.top = "0";
1476
+ container.style.right = "0";
1477
+ container.style.bottom = "0";
1478
+ container.style.display = "none";
1479
+ container.style.alignItems = "center";
1480
+ container.style.justifyContent = "center";
1481
+ container.style.pointerEvents = "none";
1482
+ container.style.zIndex = "10";
1483
+ container.style.backgroundColor = "#000";
1484
+ (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1485
+ adContainerEl = container;
1486
+ }
1487
+ if (!adVideoElement) {
1488
+ adVideoElement = createAdVideoElement();
1489
+ adContainerEl.appendChild(adVideoElement);
1490
+ setupAdEventListeners();
1491
+ } else {
1492
+ teardownCurrentPlayback();
1493
+ }
1539
1494
  }
1540
- contentVolume = contentVideo.volume;
1541
- originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1542
1495
  if (!continueLiveStreamDuringAds) {
1543
1496
  contentVideo.pause();
1544
1497
  }
@@ -1549,7 +1502,7 @@ function createPrebidAdLayer(contentVideo, options) {
1549
1502
  adVolume = originalMutedState ? 1 : originalVolume;
1550
1503
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1551
1504
  adVideoElement.muted = false;
1552
- if (adContainerEl) {
1505
+ if (!singleElementMode && adContainerEl) {
1553
1506
  adContainerEl.style.display = "flex";
1554
1507
  adContainerEl.style.pointerEvents = "auto";
1555
1508
  }
@@ -1586,7 +1539,7 @@ function createPrebidAdLayer(contentVideo, options) {
1586
1539
  }
1587
1540
  function preloadAd(bids, token) {
1588
1541
  return _async_to_generator(function() {
1589
- var winner, ad, mediaFile, videoEl, container, hls, slot, slot1;
1542
+ var winner, ad, mediaFile, slot, videoEl, container, hls, slot1, slot2;
1590
1543
  return _ts_generator(this, function(_state) {
1591
1544
  switch(_state.label){
1592
1545
  case 0:
@@ -1611,6 +1564,20 @@ function createPrebidAdLayer(contentVideo, options) {
1611
1564
  if (!mediaFile) return [
1612
1565
  2
1613
1566
  ];
1567
+ if (smartTVMode || singleElementMode) {
1568
+ slot = {
1569
+ bids: bids,
1570
+ ad: ad,
1571
+ mediaFile: mediaFile,
1572
+ videoEl: null,
1573
+ ready: true
1574
+ };
1575
+ preloadSlots.set(token, slot);
1576
+ if (debug) console.log("".concat(LOG, " [preload] Metadata-only preload (smartTV/singleElement), token=").concat(token, ", url=").concat(mediaFile.url));
1577
+ return [
1578
+ 2
1579
+ ];
1580
+ }
1614
1581
  videoEl = createAdVideoElement();
1615
1582
  videoEl.style.visibility = "hidden";
1616
1583
  videoEl.style.pointerEvents = "none";
@@ -1624,7 +1591,7 @@ function createPrebidAdLayer(contentVideo, options) {
1624
1591
  });
1625
1592
  hls.loadSource(mediaFile.url);
1626
1593
  hls.attachMedia(videoEl);
1627
- slot = {
1594
+ slot1 = {
1628
1595
  bids: bids,
1629
1596
  ad: ad,
1630
1597
  mediaFile: mediaFile,
@@ -1632,7 +1599,7 @@ function createPrebidAdLayer(contentVideo, options) {
1632
1599
  hlsInstance: hls,
1633
1600
  ready: false
1634
1601
  };
1635
- preloadSlots.set(token, slot);
1602
+ preloadSlots.set(token, slot1);
1636
1603
  hls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
1637
1604
  var s = preloadSlots.get(token);
1638
1605
  if (s) s.ready = true;
@@ -1649,14 +1616,14 @@ function createPrebidAdLayer(contentVideo, options) {
1649
1616
  } else {
1650
1617
  videoEl.src = mediaFile.url;
1651
1618
  videoEl.load();
1652
- slot1 = {
1619
+ slot2 = {
1653
1620
  bids: bids,
1654
1621
  ad: ad,
1655
1622
  mediaFile: mediaFile,
1656
1623
  videoEl: videoEl,
1657
1624
  ready: false
1658
1625
  };
1659
- preloadSlots.set(token, slot1);
1626
+ preloadSlots.set(token, slot2);
1660
1627
  videoEl.addEventListener("canplay", function() {
1661
1628
  var s = preloadSlots.get(token);
1662
1629
  if (s) s.ready = true;
@@ -1675,7 +1642,7 @@ function createPrebidAdLayer(contentVideo, options) {
1675
1642
  }
1676
1643
  function playPreloaded(token) {
1677
1644
  return _async_to_generator(function() {
1678
- var slot, contentVolume, adVolume, container;
1645
+ var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
1679
1646
  return _ts_generator(this, function(_state) {
1680
1647
  if (destroyed) return [
1681
1648
  2,
@@ -1690,6 +1657,68 @@ function createPrebidAdLayer(contentVideo, options) {
1690
1657
  }
1691
1658
  preloadSlots.delete(token);
1692
1659
  if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1660
+ contentVolume = contentVideo.volume;
1661
+ originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1662
+ sessionId = generateSessionId();
1663
+ currentAd = slot.ad;
1664
+ trackingFired = _object_spread({}, createEmptyTrackingState());
1665
+ fireTrackingPixels2(slot.ad.trackingUrls.impression);
1666
+ trackingFired.impression = true;
1667
+ if (singleElementMode) {
1668
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1669
+ teardownCurrentPlayback();
1670
+ adVideoElement = contentVideo;
1671
+ adHls = void 0;
1672
+ setupAdEventListeners();
1673
+ if (!continueLiveStreamDuringAds) {
1674
+ contentVideo.pause();
1675
+ }
1676
+ contentVideo.muted = true;
1677
+ contentVideo.volume = 0;
1678
+ adPlaying = true;
1679
+ setAdPlayingFlag(true);
1680
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1681
+ contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1682
+ contentVideo.muted = false;
1683
+ emit("content_pause");
1684
+ if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1685
+ startPlayback(slot.mediaFile);
1686
+ return [
1687
+ 2
1688
+ ];
1689
+ }
1690
+ if (smartTVMode && !slot.videoEl) {
1691
+ teardownCurrentPlayback();
1692
+ if (adVideoElement) {
1693
+ adVideoElement.remove();
1694
+ adVideoElement = void 0;
1695
+ }
1696
+ videoEl = createAdVideoElement();
1697
+ videoEl.style.visibility = "visible";
1698
+ videoEl.style.pointerEvents = "none";
1699
+ container2 = ensureAdContainer();
1700
+ container2.appendChild(videoEl);
1701
+ adVideoElement = videoEl;
1702
+ setupAdEventListeners();
1703
+ if (!continueLiveStreamDuringAds) {
1704
+ contentVideo.pause();
1705
+ }
1706
+ contentVideo.muted = true;
1707
+ contentVideo.volume = 0;
1708
+ adPlaying = true;
1709
+ setAdPlayingFlag(true);
1710
+ adVolume21 = originalMutedState ? 1 : originalVolume;
1711
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1712
+ adVideoElement.muted = false;
1713
+ container2.style.display = "flex";
1714
+ container2.style.pointerEvents = "auto";
1715
+ emit("content_pause");
1716
+ if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1717
+ startPlayback(slot.mediaFile);
1718
+ return [
1719
+ 2
1720
+ ];
1721
+ }
1693
1722
  teardownCurrentPlayback();
1694
1723
  if (adVideoElement && adVideoElement !== slot.videoEl) {
1695
1724
  adVideoElement.remove();
@@ -1699,13 +1728,6 @@ function createPrebidAdLayer(contentVideo, options) {
1699
1728
  adVideoElement = slot.videoEl;
1700
1729
  adHls = slot.hlsInstance;
1701
1730
  setupAdEventListeners();
1702
- sessionId = generateSessionId();
1703
- currentAd = slot.ad;
1704
- trackingFired = _object_spread({}, createEmptyTrackingState());
1705
- fireTrackingPixels2(slot.ad.trackingUrls.impression);
1706
- trackingFired.impression = true;
1707
- contentVolume = contentVideo.volume;
1708
- originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1709
1731
  if (!continueLiveStreamDuringAds) {
1710
1732
  contentVideo.pause();
1711
1733
  }
@@ -1720,17 +1742,10 @@ function createPrebidAdLayer(contentVideo, options) {
1720
1742
  container.style.display = "flex";
1721
1743
  container.style.pointerEvents = "auto";
1722
1744
  emit("content_pause");
1723
- if (slot.hlsInstance) {
1724
- adVideoElement.play().catch(function(error) {
1725
- console.error("".concat(LOG, " [preload] Error playing preloaded HLS ad:"), error);
1726
- handleAdError();
1727
- });
1728
- } else {
1729
- adVideoElement.play().catch(function(error) {
1730
- console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1731
- handleAdError();
1732
- });
1733
- }
1745
+ adVideoElement.play().catch(function(error) {
1746
+ console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1747
+ handleAdError();
1748
+ });
1734
1749
  return [
1735
1750
  2
1736
1751
  ];
@@ -1744,10 +1759,12 @@ function createPrebidAdLayer(contentVideo, options) {
1744
1759
  if (slot.hlsInstance) {
1745
1760
  slot.hlsInstance.destroy();
1746
1761
  }
1747
- slot.videoEl.pause();
1748
- slot.videoEl.removeAttribute("src");
1749
- slot.videoEl.load();
1750
- slot.videoEl.remove();
1762
+ if (slot.videoEl) {
1763
+ slot.videoEl.pause();
1764
+ slot.videoEl.removeAttribute("src");
1765
+ slot.videoEl.load();
1766
+ slot.videoEl.remove();
1767
+ }
1751
1768
  if (debug) console.log("".concat(LOG, " [preload] Cancelled and cleaned up token=").concat(token));
1752
1769
  }
1753
1770
  return {
@@ -1795,20 +1812,27 @@ function createPrebidAdLayer(contentVideo, options) {
1795
1812
  setAdPlayingFlag(false);
1796
1813
  contentVideo.muted = originalMutedState;
1797
1814
  contentVideo.volume = originalMutedState ? 0 : originalVolume;
1798
- if (adContainerEl) {
1799
- adContainerEl.style.display = "none";
1800
- adContainerEl.style.pointerEvents = "none";
1801
- }
1802
1815
  contentVideo.style.visibility = "visible";
1803
1816
  contentVideo.style.opacity = "1";
1804
- if (continueLiveStreamDuringAds) {
1805
- contentVideo.play().catch(function() {});
1806
- }
1807
- teardownCurrentPlayback();
1808
- if (adVideoElement) {
1809
- adVideoElement.pause();
1810
- adVideoElement.removeAttribute("src");
1811
- adVideoElement.load();
1817
+ if (singleElementMode) {
1818
+ teardownCurrentPlayback();
1819
+ contentVideo.removeAttribute("src");
1820
+ contentVideo.load();
1821
+ adVideoElement = void 0;
1822
+ } else {
1823
+ if (adContainerEl) {
1824
+ adContainerEl.style.display = "none";
1825
+ adContainerEl.style.pointerEvents = "none";
1826
+ }
1827
+ if (continueLiveStreamDuringAds) {
1828
+ contentVideo.play().catch(function() {});
1829
+ }
1830
+ teardownCurrentPlayback();
1831
+ if (adVideoElement) {
1832
+ adVideoElement.pause();
1833
+ adVideoElement.removeAttribute("src");
1834
+ adVideoElement.load();
1835
+ }
1812
1836
  }
1813
1837
  currentAd = void 0;
1814
1838
  tornDown = false;
@@ -1848,9 +1872,14 @@ function createPrebidAdLayer(contentVideo, options) {
1848
1872
  }
1849
1873
  teardownCurrentPlayback();
1850
1874
  if (adVideoElement) {
1851
- adVideoElement.pause();
1852
- adVideoElement.removeAttribute("src");
1853
- adVideoElement.remove();
1875
+ if (singleElementMode && adVideoElement === contentVideo) {
1876
+ contentVideo.removeAttribute("src");
1877
+ contentVideo.load();
1878
+ } else {
1879
+ adVideoElement.pause();
1880
+ adVideoElement.removeAttribute("src");
1881
+ adVideoElement.remove();
1882
+ }
1854
1883
  adVideoElement = void 0;
1855
1884
  }
1856
1885
  if (adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.parentElement) {
@@ -3070,11 +3099,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3070
3099
  this.video = config.videoElement;
3071
3100
  this.adTransitionGapMs = (_this_config_adTransitionGapMs = this.config.adTransitionGapMs) !== null && _this_config_adTransitionGapMs !== void 0 ? _this_config_adTransitionGapMs : 100;
3072
3101
  logBrowserInfo(config.debugAdTiming);
3073
- this.prebidManager = createPrebidManager(config.debugAdTiming !== void 0 ? {
3102
+ this.vastManager = createVastManager(config.debugAdTiming !== void 0 ? {
3074
3103
  debug: !!config.debugAdTiming
3075
3104
  } : {});
3076
- this.adLayer = createPrebidAdLayer(this.video, {
3105
+ var browserForAdLayer = detectBrowser();
3106
+ this.adLayer = createVastAdLayer(this.video, {
3077
3107
  continueLiveStreamDuringAds: false,
3108
+ smartTVMode: browserForAdLayer.isSmartTV,
3109
+ singleElementMode: browserForAdLayer.isSmartTV,
3078
3110
  debug: !!config.debugAdTiming
3079
3111
  });
3080
3112
  }
@@ -3086,19 +3118,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3086
3118
  return _ts_generator(this, function(_state) {
3087
3119
  switch(_state.label){
3088
3120
  case 0:
3089
- if (this.config.disablePrebid) return [
3121
+ if (this.config.disableAds) return [
3090
3122
  2,
3091
3123
  []
3092
3124
  ];
3093
3125
  return [
3094
3126
  4,
3095
- this.prebidManager.initialize()
3127
+ this.vastManager.initialize()
3096
3128
  ];
3097
3129
  case 1:
3098
3130
  _state.sent();
3099
3131
  return [
3100
3132
  2,
3101
- this.prebidManager.requestBidsUntilResponse(context)
3133
+ this.vastManager.requestBidsUntilResponse(context)
3102
3134
  ];
3103
3135
  }
3104
3136
  });
@@ -3133,7 +3165,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3133
3165
  adBehavior: "vod (main video pauses during ads)"
3134
3166
  });
3135
3167
  }
3136
- if (!this.config.disablePrebid) {
3168
+ if (!this.config.disableAds) {
3137
3169
  this.adLayer.updateOptions({
3138
3170
  continueLiveStreamDuringAds: false,
3139
3171
  mainHlsInstance: null
@@ -3201,7 +3233,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3201
3233
  adBehavior: adBehavior
3202
3234
  });
3203
3235
  }
3204
- if (!this.config.disablePrebid) {
3236
+ if (!this.config.disableAds) {
3205
3237
  ;
3206
3238
  this.adLayer.updateOptions({
3207
3239
  continueLiveStreamDuringAds: this.shouldContinueLiveStreamDuringAds(),
@@ -3522,7 +3554,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3522
3554
  {
3523
3555
  key: "getAdSource",
3524
3556
  value: function getAdSource() {
3525
- return "prebid";
3557
+ return "vast";
3526
3558
  }
3527
3559
  },
3528
3560
  {
@@ -3768,7 +3800,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3768
3800
  this.attached = true;
3769
3801
  this.video.autoplay = !!this.config.autoplay;
3770
3802
  this.video.muted = !!this.config.muted;
3771
- if (!this.config.disablePrebid) {
3803
+ if (!this.config.disableAds) {
3772
3804
  this.adLayer.initialize();
3773
3805
  if (!this.config.disableFiller) {
3774
3806
  this.ensureFillerVideo();
@@ -3964,7 +3996,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3964
3996
  key: "onScte35Marker",
3965
3997
  value: function onScte35Marker(marker) {
3966
3998
  var _this = this;
3967
- if (this.config.disablePrebid) return;
3999
+ if (this.config.disableAds) return;
3968
4000
  if (this.config.debugAdTiming) {
3969
4001
  console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
3970
4002
  type: marker.type,
@@ -4436,13 +4468,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4436
4468
  if (!this.isLiveStream) {
4437
4469
  return false;
4438
4470
  }
4471
+ var browser = detectBrowser();
4472
+ if (browser.isSmartTV) {
4473
+ return false;
4474
+ }
4439
4475
  return true;
4440
4476
  }
4441
4477
  },
4442
4478
  {
4443
4479
  key: "startAdPrefetch",
4444
4480
  value: function startAdPrefetch(marker, fragmentSn) {
4445
- if (this.config.disablePrebid) return;
4481
+ if (this.config.disableAds) return;
4446
4482
  if (this.pendingAdBreak || this.inAdBreak) {
4447
4483
  return;
4448
4484
  }
@@ -4464,25 +4500,75 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4464
4500
  key: "runAdPrefetch",
4465
4501
  value: function runAdPrefetch(marker) {
4466
4502
  return _async_to_generator(function() {
4467
- var _this, _marker_durationSeconds, durSec, estimatedCount, context, fetches, results, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, result, token;
4503
+ var _this, _marker_durationSeconds, _ref, _firstBids_, durSec, context, firstBids, unused, adDurationSec, estimatedCount, firstToken, remaining, results, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, result, token;
4468
4504
  return _ts_generator(this, function(_state) {
4469
4505
  switch(_state.label){
4470
4506
  case 0:
4471
4507
  _this = this;
4472
4508
  durSec = (_marker_durationSeconds = marker.durationSeconds) !== null && _marker_durationSeconds !== void 0 ? _marker_durationSeconds : 60;
4473
- estimatedCount = Math.min(4, Math.max(1, Math.ceil(durSec / 30)));
4474
- if (this.config.debugAdTiming) {
4475
- console.log("[PREFETCH] Firing ".concat(estimatedCount, " parallel bid request(s) for ").concat(durSec, "s break"));
4476
- }
4477
4509
  context = {
4478
4510
  breakDurationSec: durSec,
4479
4511
  remainingBreakSec: durSec
4480
4512
  };
4481
- fetches = Array.from({
4482
- length: estimatedCount
4513
+ _state.label = 1;
4514
+ case 1:
4515
+ _state.trys.push([
4516
+ 1,
4517
+ 3,
4518
+ ,
4519
+ 4
4520
+ ]);
4521
+ return [
4522
+ 4,
4523
+ this.adRequest(_object_spread_props(_object_spread({}, context), {
4524
+ adIndex: 1
4525
+ }))
4526
+ ];
4527
+ case 2:
4528
+ firstBids = _state.sent();
4529
+ return [
4530
+ 3,
4531
+ 4
4532
+ ];
4533
+ case 3:
4534
+ unused = _state.sent();
4535
+ firstBids = [];
4536
+ return [
4537
+ 3,
4538
+ 4
4539
+ ];
4540
+ case 4:
4541
+ if (this.inAdBreak) return [
4542
+ 2
4543
+ ];
4544
+ if (firstBids.length === 0) {
4545
+ if (this.config.debugAdTiming) {
4546
+ console.log("[PREFETCH] First VAST request returned no ad, aborting prefetch");
4547
+ }
4548
+ return [
4549
+ 2
4550
+ ];
4551
+ }
4552
+ adDurationSec = (_ref = (_firstBids_ = firstBids[0]) === null || _firstBids_ === void 0 ? void 0 : _firstBids_.durationSec) !== null && _ref !== void 0 ? _ref : 30;
4553
+ estimatedCount = Math.max(1, Math.ceil(durSec / adDurationSec));
4554
+ if (this.config.debugAdTiming) {
4555
+ console.log("[PREFETCH] Ad duration=".concat(adDurationSec, "s, break=").concat(durSec, "s → ").concat(estimatedCount, " ad(s) needed"));
4556
+ }
4557
+ firstToken = "preload_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 7));
4558
+ this.preloadedTokens.push(firstToken);
4559
+ void this.adLayer.preloadAd(firstBids, firstToken);
4560
+ if (this.config.debugAdTiming) {
4561
+ console.log("[PREFETCH] First ad preloading, token=".concat(firstToken));
4562
+ }
4563
+ if (!(estimatedCount > 1)) return [
4564
+ 3,
4565
+ 6
4566
+ ];
4567
+ remaining = Array.from({
4568
+ length: estimatedCount - 1
4483
4569
  }, function(_, i) {
4484
4570
  return _this.adRequest(_object_spread_props(_object_spread({}, context), {
4485
- adIndex: i + 1
4571
+ adIndex: i + 2
4486
4572
  })).then(function(bids) {
4487
4573
  return {
4488
4574
  ok: true,
@@ -4496,9 +4582,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4496
4582
  });
4497
4583
  return [
4498
4584
  4,
4499
- Promise.all(fetches)
4585
+ Promise.all(remaining)
4500
4586
  ];
4501
- case 1:
4587
+ case 5:
4502
4588
  results = _state.sent();
4503
4589
  _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4504
4590
  try {
@@ -4510,7 +4596,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4510
4596
  this.preloadedTokens.push(token);
4511
4597
  void this.adLayer.preloadAd(result.value, token);
4512
4598
  if (this.config.debugAdTiming) {
4513
- console.log("[PREFETCH] Bid received, preloading video token=".concat(token));
4599
+ console.log("[PREFETCH] Additional ad preloading, token=".concat(token));
4514
4600
  }
4515
4601
  }
4516
4602
  }
@@ -4528,6 +4614,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4528
4614
  }
4529
4615
  }
4530
4616
  }
4617
+ _state.label = 6;
4618
+ case 6:
4531
4619
  if (this.config.debugAdTiming) {
4532
4620
  console.log("[PREFETCH] Pre-fetch complete: ".concat(this.preloadedTokens.length, " ad(s) queued"));
4533
4621
  }
@@ -4591,7 +4679,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4591
4679
  switch(_state.label){
4592
4680
  case 0:
4593
4681
  _loop = function() {
4594
- var remaining, prefetchContext, bids, err, bids1, remainingNow, delay, elapsed, remaining1, context, bids2, remainingNow1, err1;
4682
+ var remaining, prefetchContext, bids, err, bids1, remainingNow, urgentNeedAd, delay, elapsed, remaining1, context, bids2, remainingNow1, err1, sleepMs;
4595
4683
  return _ts_generator(this, function(_state) {
4596
4684
  switch(_state.label){
4597
4685
  case 0:
@@ -4642,6 +4730,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4642
4730
  if (bids.length > 0) {
4643
4731
  _this.consecutiveFailures = 0;
4644
4732
  _this.pendingNextAdBids = bids;
4733
+ _this.totalAdsInBreak = Math.max(_this.totalAdsInBreak, _this.currentAdIndex + _this.preloadedTokens.length + 1);
4645
4734
  if (_this.config.debugAdTiming) {
4646
4735
  console.log("[CONTINUOUS-FETCH] Pre-fetched next ad stored as pending");
4647
4736
  }
@@ -4726,7 +4815,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4726
4815
  "continue"
4727
4816
  ];
4728
4817
  case 12:
4729
- delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (_this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
4818
+ urgentNeedAd = _this.inAdBreak && !_this.adLayer.isAdPlaying();
4819
+ delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (!urgentNeedAd && _this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
4730
4820
  elapsed = Date.now() - _this.lastAdRequestTime;
4731
4821
  if (!(elapsed < delay && _this.lastAdRequestTime > 0)) return [
4732
4822
  3,
@@ -4781,6 +4871,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4781
4871
  17
4782
4872
  ];
4783
4873
  _this.pendingNextAdBids = bids2;
4874
+ _this.totalAdsInBreak = Math.max(_this.totalAdsInBreak, _this.currentAdIndex + _this.preloadedTokens.length + 1);
4784
4875
  if (_this.config.debugAdTiming) {
4785
4876
  console.log("[CONTINUOUS-FETCH] Next ad response stored (ad currently playing or in transition)");
4786
4877
  }
@@ -4844,10 +4935,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4844
4935
  24
4845
4936
  ];
4846
4937
  case 24:
4938
+ sleepMs = _this.inAdBreak && !_this.adLayer.isAdPlaying() ? 0 : backoffMs();
4847
4939
  return [
4848
4940
  4,
4849
4941
  new Promise(function(r) {
4850
- return setTimeout(r, backoffMs());
4942
+ return setTimeout(r, sleepMs);
4851
4943
  })
4852
4944
  ];
4853
4945
  case 25:
@@ -4934,7 +5026,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4934
5026
  this.inAdBreak = true;
4935
5027
  this.currentAdBreakStartWallClockMs = Date.now();
4936
5028
  this.currentAdIndex = 0;
4937
- this.totalAdsInBreak = 1;
5029
+ this.totalAdsInBreak = Math.max(1, this.preloadedTokens.length);
4938
5030
  this.adPodQueue = [];
4939
5031
  if (!this.config.disableFiller) this.showAds = true;
4940
5032
  if (adBreakDurationMs != null) {
@@ -5159,6 +5251,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5159
5251
  3
5160
5252
  ];
5161
5253
  this.pendingNextAdBids = bids;
5254
+ this.totalAdsInBreak = Math.max(this.totalAdsInBreak, this.currentAdIndex + this.preloadedTokens.length);
5162
5255
  return [
5163
5256
  3,
5164
5257
  5
@@ -5527,40 +5620,45 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5527
5620
  var browser = detectBrowser();
5528
5621
  var isSmartTV = browser.tizenVersion !== void 0 || browser.webOSVersion !== void 0;
5529
5622
  if (isSmartTV && this.hls) {
5530
- if (!restoredMuted) {
5531
- var hlsRef = this.hls;
5532
- var savedMuted = restoredMuted;
5533
- var savedVolume = restoredVolume;
5534
- var onManifestParsedRestore = function onManifestParsedRestore1() {
5535
- hlsRef.off(import_hls2.default.Events.MANIFEST_PARSED, onManifestParsedRestore);
5536
- if (!_this.inAdBreak && !_this.adLayer.isAdPlaying()) {
5537
- if (_this.video.muted !== savedMuted) _this.video.muted = savedMuted;
5538
- if (Math.abs(_this.video.volume - savedVolume) > 0.01) _this.video.volume = savedVolume;
5539
- if (_this.config.debugAdTiming) {
5540
- console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
5541
- }
5623
+ var hlsRef = this.hls;
5624
+ var savedMuted = restoredMuted;
5625
+ var savedVolume = restoredVolume;
5626
+ var onManifestParsedRestore = function onManifestParsedRestore1() {
5627
+ hlsRef.off(import_hls2.default.Events.MANIFEST_PARSED, onManifestParsedRestore);
5628
+ if (!_this.inAdBreak && !_this.adLayer.isAdPlaying()) {
5629
+ var _this_video_play;
5630
+ if (_this.video.muted !== savedMuted) _this.video.muted = savedMuted;
5631
+ if (Math.abs(_this.video.volume - savedVolume) > 0.01) _this.video.volume = savedVolume;
5632
+ if (_this.config.debugAdTiming) {
5633
+ console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
5542
5634
  }
5543
- };
5544
- hlsRef.on(import_hls2.default.Events.MANIFEST_PARSED, onManifestParsedRestore);
5545
- }
5635
+ hlsRef.startLoad(-1);
5636
+ (_this_video_play = _this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
5637
+ if (_this.config.debugAdTiming) {
5638
+ console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
5639
+ }
5640
+ }
5641
+ };
5642
+ hlsRef.on(import_hls2.default.Events.MANIFEST_PARSED, onManifestParsedRestore);
5546
5643
  this.hls.attachMedia(this.video);
5547
5644
  if (this.config.debugAdTiming) {
5548
5645
  console.log("[StormcloudVideoPlayer] Smart TV: re-attached HLS to video element after ad break to restore media pipeline");
5549
5646
  }
5550
- }
5551
- if (this.shouldContinueLiveStreamDuringAds()) {
5552
- var _this_video_play;
5553
- if (this.config.debugAdTiming) {
5554
- if (this.video.paused) {
5555
- console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
5556
- } else {
5557
- console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
5647
+ } else {
5648
+ if (this.shouldContinueLiveStreamDuringAds()) {
5649
+ var _this_video_play;
5650
+ if (this.config.debugAdTiming) {
5651
+ if (this.video.paused) {
5652
+ console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
5653
+ } else {
5654
+ console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
5655
+ }
5558
5656
  }
5657
+ (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
5658
+ } else if (this.video.paused) {
5659
+ var _this_video_play1;
5660
+ (_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
5559
5661
  }
5560
- (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
5561
- } else if (this.video.paused) {
5562
- var _this_video_play1;
5563
- (_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
5564
5662
  }
5565
5663
  this.syncMainContentAudioWhenVisible();
5566
5664
  if (!restoredMuted) {
@@ -5611,6 +5709,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5611
5709
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max consecutive failures reached (".concat(this.consecutiveFailures, "), ending ad break gracefully"));
5612
5710
  }
5613
5711
  this.handleAdPodComplete();
5712
+ return;
5713
+ }
5714
+ if (this.inAdBreak && !this.config.disableFiller) {
5715
+ if (this.config.debugAdTiming) {
5716
+ console.log("[CONTINUOUS-FETCH] Ad failure in active break \u2014 showing filler while awaiting next ad");
5717
+ }
5718
+ this.showPlaceholderLayer();
5719
+ this.adLayer.showPlaceholder();
5614
5720
  }
5615
5721
  }
5616
5722
  },
@@ -5950,7 +6056,7 @@ var CRITICAL_PROPS = [
5950
6056
  ];
5951
6057
  var CONTROLS_HIDE_DELAY = 3e3;
5952
6058
  var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
5953
- var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disablePrebid = props.disablePrebid, disableFiller = props.disableFiller, restVideoAttrs = _object_without_properties(props, [
6059
+ var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, minSegmentsBeforePlay = props.minSegmentsBeforePlay, disableAds = props.disableAds, disableFiller = props.disableFiller, restVideoAttrs = _object_without_properties(props, [
5954
6060
  "src",
5955
6061
  "autoplay",
5956
6062
  "muted",
@@ -5976,7 +6082,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
5976
6082
  "children",
5977
6083
  "licenseKey",
5978
6084
  "minSegmentsBeforePlay",
5979
- "disablePrebid",
6085
+ "disableAds",
5980
6086
  "disableFiller"
5981
6087
  ]);
5982
6088
  var videoRef = (0, import_react.useRef)(null);
@@ -6134,7 +6240,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
6134
6240
  if (onControlClick !== void 0) cfg.onControlClick = onControlClick;
6135
6241
  if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
6136
6242
  if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
6137
- if (disablePrebid !== void 0) cfg.disablePrebid = disablePrebid;
6243
+ if (disableAds !== void 0) cfg.disableAds = disableAds;
6138
6244
  cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
6139
6245
  var player = new StormcloudVideoPlayer(cfg);
6140
6246
  playerRef.current = player;
@@ -7192,7 +7298,7 @@ var defaultProps = {
7192
7298
  licenseKey: "",
7193
7299
  adFailsafeTimeoutMs: 1e4,
7194
7300
  minSegmentsBeforePlay: 2,
7195
- disablePrebid: false,
7301
+ disableAds: false,
7196
7302
  disableFiller: true,
7197
7303
  onStart: noop,
7198
7304
  onPlay: noop,
@@ -7375,7 +7481,7 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react3_Component) {
7375
7481
  if (_this1.props.licenseKey !== void 0) config.licenseKey = _this1.props.licenseKey;
7376
7482
  if (_this1.props.adFailsafeTimeoutMs !== void 0) config.adFailsafeTimeoutMs = _this1.props.adFailsafeTimeoutMs;
7377
7483
  if (_this1.props.minSegmentsBeforePlay !== void 0) config.minSegmentsBeforePlay = _this1.props.minSegmentsBeforePlay;
7378
- if (_this1.props.disablePrebid !== void 0) config.disablePrebid = _this1.props.disablePrebid;
7484
+ if (_this1.props.disableAds !== void 0) config.disableAds = _this1.props.disableAds;
7379
7485
  _this1.player = new StormcloudVideoPlayer(config);
7380
7486
  (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
7381
7487
  return [
@@ -8334,9 +8440,9 @@ var StormcloudPlayer_default = StormcloudPlayer;
8334
8440
  StormcloudVideoPlayer: StormcloudVideoPlayer,
8335
8441
  StormcloudVideoPlayerComponent: StormcloudVideoPlayerComponent,
8336
8442
  canPlay: canPlay,
8337
- createPrebidAdLayer: createPrebidAdLayer,
8338
- createPrebidManager: createPrebidManager,
8339
8443
  createStormcloudPlayer: createStormcloudPlayer,
8444
+ createVastAdLayer: createVastAdLayer,
8445
+ createVastManager: createVastManager,
8340
8446
  detectBrowser: detectBrowser,
8341
8447
  getBrowserConfigOverrides: getBrowserConfigOverrides,
8342
8448
  getBrowserID: getBrowserID,