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.js CHANGED
@@ -370,362 +370,6 @@ function _ts_values(o) {
370
370
  import React, { useEffect, useRef, useMemo, useCallback } from "react";
371
371
  // src/player/StormcloudVideoPlayer.ts
372
372
  import Hls2 from "hls.js";
373
- // src/sdk/prebid.ts
374
- var DEFAULT_TIMEOUT_MS = 3e3;
375
- var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
376
- function createPrebidManager() {
377
- var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
378
- var _options_debug;
379
- var initialized = false;
380
- var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
381
- function log() {
382
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
383
- args[_key] = arguments[_key];
384
- }
385
- if (debug) {
386
- var _console;
387
- (_console = console).log.apply(_console, [
388
- "[Prebid]"
389
- ].concat(_to_consumable_array(args)));
390
- }
391
- }
392
- function warn() {
393
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
394
- args[_key] = arguments[_key];
395
- }
396
- var _console;
397
- (_console = console).warn.apply(_console, [
398
- "[Prebid]"
399
- ].concat(_to_consumable_array(args)));
400
- }
401
- function parseResponse(data) {
402
- var bids = [];
403
- var seatbids = (data === null || data === void 0 ? void 0 : data.seatbid) || [];
404
- var currency = (data === null || data === void 0 ? void 0 : data.cur) || "USD";
405
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
406
- try {
407
- for(var _iterator = seatbids[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
408
- var seatbid = _step.value;
409
- var seat = seatbid.seat || "unknown";
410
- var bidArray = seatbid.bid || [];
411
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
412
- try {
413
- for(var _iterator1 = bidArray[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
414
- var bid = _step1.value;
415
- var _bid_ext_prebid_cache_vastXml, _bid_ext_prebid_cache, _bid_ext_prebid, _bid_ext;
416
- 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;
417
- var vastXml = bid.adm || void 0;
418
- var bidResponse = {
419
- bidder: seat,
420
- cpm: bid.price || 0,
421
- width: bid.w || 0,
422
- height: bid.h || 0,
423
- adId: bid.id || "",
424
- impId: bid.impid || "",
425
- creativeId: bid.crid || "",
426
- currency: currency
427
- };
428
- if (cacheUrl) bidResponse.vastUrl = cacheUrl;
429
- if (vastXml) bidResponse.vastXml = vastXml;
430
- if (bid.adomain) bidResponse.adomain = bid.adomain;
431
- bids.push(bidResponse);
432
- }
433
- } catch (err) {
434
- _didIteratorError1 = true;
435
- _iteratorError1 = err;
436
- } finally{
437
- try {
438
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
439
- _iterator1.return();
440
- }
441
- } finally{
442
- if (_didIteratorError1) {
443
- throw _iteratorError1;
444
- }
445
- }
446
- }
447
- }
448
- } catch (err) {
449
- _didIteratorError = true;
450
- _iteratorError = err;
451
- } finally{
452
- try {
453
- if (!_iteratorNormalCompletion && _iterator.return != null) {
454
- _iterator.return();
455
- }
456
- } finally{
457
- if (_didIteratorError) {
458
- throw _iteratorError;
459
- }
460
- }
461
- }
462
- bids.sort(function(a, b) {
463
- return b.cpm - a.cpm;
464
- });
465
- return bids;
466
- }
467
- function initialize() {
468
- return _async_to_generator(function() {
469
- return _ts_generator(this, function(_state) {
470
- if (initialized) return [
471
- 2
472
- ];
473
- initialized = true;
474
- log("Initialized, auction URL:", AUCTION_URL);
475
- return [
476
- 2
477
- ];
478
- });
479
- })();
480
- }
481
- function requestBids(context) {
482
- return _async_to_generator(function() {
483
- var timeout, controller, timeoutId, _data_ext, _data_ext1, fetchOptions, body, response, body1, data, bids, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, b, error;
484
- return _ts_generator(this, function(_state) {
485
- switch(_state.label){
486
- case 0:
487
- if (!initialized) {
488
- throw new Error("Prebid not initialized. Call initialize() first.");
489
- }
490
- timeout = DEFAULT_TIMEOUT_MS;
491
- log("Fetching auction response from:", AUCTION_URL);
492
- controller = typeof AbortController !== "undefined" ? new AbortController() : null;
493
- timeoutId = setTimeout(function() {
494
- controller === null || controller === void 0 ? void 0 : controller.abort();
495
- }, timeout + 2e3);
496
- _state.label = 1;
497
- case 1:
498
- _state.trys.push([
499
- 1,
500
- 6,
501
- ,
502
- 7
503
- ]);
504
- fetchOptions = {
505
- method: "POST"
506
- };
507
- if (controller) {
508
- fetchOptions.signal = controller.signal;
509
- }
510
- if ((context === null || context === void 0 ? void 0 : context.remainingBreakSec) != null) {
511
- body = {
512
- imp: [
513
- {
514
- video: {
515
- maxduration: Math.floor(context.remainingBreakSec)
516
- }
517
- }
518
- ]
519
- };
520
- fetchOptions.body = JSON.stringify(body);
521
- fetchOptions.headers = {
522
- "Content-Type": "application/json"
523
- };
524
- log("Sending context to auction: maxduration=", Math.floor(context.remainingBreakSec));
525
- }
526
- return [
527
- 4,
528
- fetch(AUCTION_URL, fetchOptions)
529
- ];
530
- case 2:
531
- response = _state.sent();
532
- clearTimeout(timeoutId);
533
- if (!!response.ok) return [
534
- 3,
535
- 4
536
- ];
537
- return [
538
- 4,
539
- response.text().catch(function() {
540
- return "";
541
- })
542
- ];
543
- case 3:
544
- body1 = _state.sent();
545
- throw new Error("Prebid Server returned HTTP ".concat(response.status, ": ").concat(body1.slice(0, 200)));
546
- case 4:
547
- return [
548
- 4,
549
- response.json()
550
- ];
551
- case 5:
552
- data = _state.sent();
553
- if (debug && (data === null || data === void 0 ? void 0 : (_data_ext = data.ext) === null || _data_ext === void 0 ? void 0 : _data_ext.responsetimemillis)) {
554
- log("Bidder response times:", data.ext.responsetimemillis);
555
- }
556
- if (debug && (data === null || data === void 0 ? void 0 : (_data_ext1 = data.ext) === null || _data_ext1 === void 0 ? void 0 : _data_ext1.errors)) {
557
- warn("Auction errors:", data.ext.errors);
558
- }
559
- bids = parseResponse(data);
560
- log("Received ".concat(bids.length, " bid(s)"));
561
- if (debug) {
562
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
563
- try {
564
- for(_iterator = bids[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
565
- b = _step.value;
566
- 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]" : ""));
567
- }
568
- } catch (err) {
569
- _didIteratorError = true;
570
- _iteratorError = err;
571
- } finally{
572
- try {
573
- if (!_iteratorNormalCompletion && _iterator.return != null) {
574
- _iterator.return();
575
- }
576
- } finally{
577
- if (_didIteratorError) {
578
- throw _iteratorError;
579
- }
580
- }
581
- }
582
- }
583
- return [
584
- 2,
585
- bids
586
- ];
587
- case 6:
588
- error = _state.sent();
589
- clearTimeout(timeoutId);
590
- if ((error === null || error === void 0 ? void 0 : error.name) === "AbortError") {
591
- warn("Auction request timed out after ".concat(timeout + 2e3, "ms"));
592
- return [
593
- 2,
594
- []
595
- ];
596
- }
597
- throw error;
598
- case 7:
599
- return [
600
- 2
601
- ];
602
- }
603
- });
604
- })();
605
- }
606
- var REQUEST_BIDS_MAX_RETRIES = 3;
607
- var REQUEST_BIDS_BACKOFF_MS = 1500;
608
- function requestBidsUntilResponse(context) {
609
- return _async_to_generator(function() {
610
- var _loop, lastError, attempt, _ret;
611
- return _ts_generator(this, function(_state) {
612
- switch(_state.label){
613
- case 0:
614
- _loop = function(attempt) {
615
- var bids, err, delay;
616
- return _ts_generator(this, function(_state) {
617
- switch(_state.label){
618
- case 0:
619
- _state.trys.push([
620
- 0,
621
- 2,
622
- ,
623
- 3
624
- ]);
625
- return [
626
- 4,
627
- requestBids(context)
628
- ];
629
- case 1:
630
- bids = _state.sent();
631
- if (bids.length > 0) {
632
- log("requestBidsUntilResponse: got ".concat(bids.length, " bid(s) on attempt ").concat(attempt));
633
- return [
634
- 2,
635
- {
636
- v: bids
637
- }
638
- ];
639
- }
640
- log("requestBidsUntilResponse: no bids on attempt ".concat(attempt, "/").concat(REQUEST_BIDS_MAX_RETRIES));
641
- return [
642
- 3,
643
- 3
644
- ];
645
- case 2:
646
- err = _state.sent();
647
- lastError = err;
648
- warn("requestBidsUntilResponse: attempt ".concat(attempt, "/").concat(REQUEST_BIDS_MAX_RETRIES, " failed:"), err);
649
- return [
650
- 3,
651
- 3
652
- ];
653
- case 3:
654
- if (!(attempt < REQUEST_BIDS_MAX_RETRIES)) return [
655
- 3,
656
- 5
657
- ];
658
- delay = REQUEST_BIDS_BACKOFF_MS * attempt;
659
- log("requestBidsUntilResponse: waiting ".concat(delay, "ms before retry"));
660
- return [
661
- 4,
662
- new Promise(function(resolve) {
663
- return setTimeout(resolve, delay);
664
- })
665
- ];
666
- case 4:
667
- _state.sent();
668
- _state.label = 5;
669
- case 5:
670
- return [
671
- 2
672
- ];
673
- }
674
- });
675
- };
676
- if (!initialized) {
677
- throw new Error("Prebid not initialized. Call initialize() first.");
678
- }
679
- attempt = 1;
680
- _state.label = 1;
681
- case 1:
682
- if (!(attempt <= REQUEST_BIDS_MAX_RETRIES)) return [
683
- 3,
684
- 4
685
- ];
686
- return [
687
- 5,
688
- _ts_values(_loop(attempt))
689
- ];
690
- case 2:
691
- _ret = _state.sent();
692
- if (_type_of(_ret) === "object") return [
693
- 2,
694
- _ret.v
695
- ];
696
- _state.label = 3;
697
- case 3:
698
- attempt++;
699
- return [
700
- 3,
701
- 1
702
- ];
703
- case 4:
704
- if (_instanceof(lastError, Error)) {
705
- throw lastError;
706
- }
707
- return [
708
- 2,
709
- []
710
- ];
711
- }
712
- });
713
- })();
714
- }
715
- function destroy() {
716
- initialized = false;
717
- log("Destroyed");
718
- }
719
- return {
720
- initialize: initialize,
721
- requestBids: requestBids,
722
- requestBidsUntilResponse: requestBidsUntilResponse,
723
- destroy: destroy,
724
- get isInitialized () {
725
- return initialized;
726
- }
727
- };
728
- }
729
373
  // src/sdk/vastParser.ts
730
374
  function isHlsType(type) {
731
375
  return type === "application/x-mpegURL" || type.includes("m3u8");
@@ -1024,11 +668,271 @@ function fireTrackingPixels(urls, sessionId) {
1024
668
  } catch (error) {
1025
669
  console.warn("".concat(logPrefix, " Error firing tracking pixel:"), error);
1026
670
  }
1027
- });
671
+ });
672
+ }
673
+ // src/sdk/vastManager.ts
674
+ 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";
675
+ var DEFAULT_TIMEOUT_MS = 5e3;
676
+ var MAX_RETRIES = 3;
677
+ var RETRY_BACKOFF_MS = 1500;
678
+ function createVastManager() {
679
+ var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
680
+ var _options_debug;
681
+ var initialized = false;
682
+ var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
683
+ function log() {
684
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
685
+ args[_key] = arguments[_key];
686
+ }
687
+ if (debug) {
688
+ var _console;
689
+ (_console = console).log.apply(_console, [
690
+ "[VastManager]"
691
+ ].concat(_to_consumable_array(args)));
692
+ }
693
+ }
694
+ function warn() {
695
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
696
+ args[_key] = arguments[_key];
697
+ }
698
+ var _console;
699
+ (_console = console).warn.apply(_console, [
700
+ "[VastManager]"
701
+ ].concat(_to_consumable_array(args)));
702
+ }
703
+ function initialize() {
704
+ return _async_to_generator(function() {
705
+ return _ts_generator(this, function(_state) {
706
+ if (initialized) return [
707
+ 2
708
+ ];
709
+ initialized = true;
710
+ log("Initialized, VAST tag URL:", VAST_TAG_URL.split("?")[0]);
711
+ return [
712
+ 2
713
+ ];
714
+ });
715
+ })();
716
+ }
717
+ function requestBids(_context) {
718
+ return _async_to_generator(function() {
719
+ var correlator, url, controller, timeoutId, _ref, _ref1, _vastAd_mediaFiles_, _vastAd_mediaFiles_1, fetchOptions, response, vastXml, vastAd, bid, error;
720
+ return _ts_generator(this, function(_state) {
721
+ switch(_state.label){
722
+ case 0:
723
+ if (!initialized) {
724
+ throw new Error("VastManager not initialized. Call initialize() first.");
725
+ }
726
+ correlator = Math.floor(Math.random() * 1e12).toString();
727
+ url = VAST_TAG_URL.replace("[placeholder]", correlator);
728
+ log("Fetching VAST tag, correlator:", correlator);
729
+ controller = typeof AbortController !== "undefined" ? new AbortController() : null;
730
+ timeoutId = setTimeout(function() {
731
+ return controller === null || controller === void 0 ? void 0 : controller.abort();
732
+ }, DEFAULT_TIMEOUT_MS);
733
+ _state.label = 1;
734
+ case 1:
735
+ _state.trys.push([
736
+ 1,
737
+ 4,
738
+ ,
739
+ 5
740
+ ]);
741
+ fetchOptions = {
742
+ method: "GET",
743
+ mode: "cors",
744
+ credentials: "omit",
745
+ headers: {
746
+ Accept: "application/xml, text/xml, */*"
747
+ },
748
+ referrerPolicy: "no-referrer-when-downgrade"
749
+ };
750
+ if (controller) fetchOptions.signal = controller.signal;
751
+ return [
752
+ 4,
753
+ fetch(url, fetchOptions)
754
+ ];
755
+ case 2:
756
+ response = _state.sent();
757
+ clearTimeout(timeoutId);
758
+ if (!response.ok) {
759
+ throw new Error("VAST request returned HTTP ".concat(response.status));
760
+ }
761
+ return [
762
+ 4,
763
+ response.text()
764
+ ];
765
+ case 3:
766
+ vastXml = _state.sent();
767
+ log("VAST XML received, length:", vastXml.length);
768
+ vastAd = parseVastXml(vastXml, "mp4-first", "[VastManager]");
769
+ if (!vastAd) {
770
+ log("VAST parsed but no usable ad found");
771
+ return [
772
+ 2,
773
+ []
774
+ ];
775
+ }
776
+ log("Ad parsed: id=".concat(vastAd.id, ", duration=").concat(vastAd.duration, "s, mediaFiles=").concat(vastAd.mediaFiles.length));
777
+ bid = {
778
+ bidder: "vast-direct",
779
+ cpm: 0,
780
+ vastXml: vastXml,
781
+ width: (_ref = (_vastAd_mediaFiles_ = vastAd.mediaFiles[0]) === null || _vastAd_mediaFiles_ === void 0 ? void 0 : _vastAd_mediaFiles_.width) !== null && _ref !== void 0 ? _ref : 0,
782
+ 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,
783
+ adId: vastAd.id,
784
+ impId: correlator,
785
+ creativeId: vastAd.id,
786
+ currency: "USD",
787
+ durationSec: vastAd.duration
788
+ };
789
+ return [
790
+ 2,
791
+ [
792
+ bid
793
+ ]
794
+ ];
795
+ case 4:
796
+ error = _state.sent();
797
+ clearTimeout(timeoutId);
798
+ if ((error === null || error === void 0 ? void 0 : error.name) === "AbortError") {
799
+ warn("VAST request timed out after ".concat(DEFAULT_TIMEOUT_MS, "ms"));
800
+ return [
801
+ 2,
802
+ []
803
+ ];
804
+ }
805
+ throw error;
806
+ case 5:
807
+ return [
808
+ 2
809
+ ];
810
+ }
811
+ });
812
+ })();
813
+ }
814
+ function requestBidsUntilResponse(context) {
815
+ return _async_to_generator(function() {
816
+ var _loop, lastError, attempt, _ret;
817
+ return _ts_generator(this, function(_state) {
818
+ switch(_state.label){
819
+ case 0:
820
+ _loop = function(attempt) {
821
+ var bids, err, delay;
822
+ return _ts_generator(this, function(_state) {
823
+ switch(_state.label){
824
+ case 0:
825
+ _state.trys.push([
826
+ 0,
827
+ 2,
828
+ ,
829
+ 3
830
+ ]);
831
+ return [
832
+ 4,
833
+ requestBids(context)
834
+ ];
835
+ case 1:
836
+ bids = _state.sent();
837
+ if (bids.length > 0) {
838
+ log("requestBidsUntilResponse: got ".concat(bids.length, " ad(s) on attempt ").concat(attempt));
839
+ return [
840
+ 2,
841
+ {
842
+ v: bids
843
+ }
844
+ ];
845
+ }
846
+ log("requestBidsUntilResponse: no ads on attempt ".concat(attempt, "/").concat(MAX_RETRIES));
847
+ return [
848
+ 3,
849
+ 3
850
+ ];
851
+ case 2:
852
+ err = _state.sent();
853
+ lastError = err;
854
+ warn("requestBidsUntilResponse: attempt ".concat(attempt, "/").concat(MAX_RETRIES, " failed:"), err);
855
+ return [
856
+ 3,
857
+ 3
858
+ ];
859
+ case 3:
860
+ if (!(attempt < MAX_RETRIES)) return [
861
+ 3,
862
+ 5
863
+ ];
864
+ delay = RETRY_BACKOFF_MS * attempt;
865
+ log("requestBidsUntilResponse: waiting ".concat(delay, "ms before retry"));
866
+ return [
867
+ 4,
868
+ new Promise(function(resolve) {
869
+ return setTimeout(resolve, delay);
870
+ })
871
+ ];
872
+ case 4:
873
+ _state.sent();
874
+ _state.label = 5;
875
+ case 5:
876
+ return [
877
+ 2
878
+ ];
879
+ }
880
+ });
881
+ };
882
+ if (!initialized) {
883
+ throw new Error("VastManager not initialized. Call initialize() first.");
884
+ }
885
+ attempt = 1;
886
+ _state.label = 1;
887
+ case 1:
888
+ if (!(attempt <= MAX_RETRIES)) return [
889
+ 3,
890
+ 4
891
+ ];
892
+ return [
893
+ 5,
894
+ _ts_values(_loop(attempt))
895
+ ];
896
+ case 2:
897
+ _ret = _state.sent();
898
+ if (_type_of(_ret) === "object") return [
899
+ 2,
900
+ _ret.v
901
+ ];
902
+ _state.label = 3;
903
+ case 3:
904
+ attempt++;
905
+ return [
906
+ 3,
907
+ 1
908
+ ];
909
+ case 4:
910
+ if (_instanceof(lastError, Error)) throw lastError;
911
+ return [
912
+ 2,
913
+ []
914
+ ];
915
+ }
916
+ });
917
+ })();
918
+ }
919
+ function destroy() {
920
+ initialized = false;
921
+ log("Destroyed");
922
+ }
923
+ return {
924
+ initialize: initialize,
925
+ requestBids: requestBids,
926
+ requestBidsUntilResponse: requestBidsUntilResponse,
927
+ destroy: destroy,
928
+ get isInitialized () {
929
+ return initialized;
930
+ }
931
+ };
1028
932
  }
1029
- // src/sdk/prebidAdLayer.ts
933
+ // src/sdk/vastAdLayer.ts
1030
934
  import Hls from "hls.js";
1031
- var LOG = "[PrebidAdLayer]";
935
+ var LOG = "[VastAdLayer]";
1032
936
  function resolveBidToVastAd(winner, logPrefix) {
1033
937
  if (winner.vastXml) {
1034
938
  var ad = parseVastXml(winner.vastXml, "mp4-first", logPrefix);
@@ -1039,15 +943,17 @@ function resolveBidToVastAd(winner, logPrefix) {
1039
943
  }
1040
944
  return Promise.resolve(null);
1041
945
  }
1042
- function createPrebidAdLayer(contentVideo, options) {
1043
- var _ref, _ref1;
946
+ function createVastAdLayer(contentVideo, options) {
947
+ var _ref, _ref1, _ref2, _ref3;
1044
948
  var adPlaying = false;
1045
949
  var originalMutedState = false;
1046
950
  var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
1047
951
  var listeners = /* @__PURE__ */ new Map();
1048
952
  var mainHlsInstance = options === null || options === void 0 ? void 0 : options.mainHlsInstance;
1049
953
  var continueLiveStreamDuringAds = (_ref = options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) !== null && _ref !== void 0 ? _ref : false;
1050
- var debug = (_ref1 = options === null || options === void 0 ? void 0 : options.debug) !== null && _ref1 !== void 0 ? _ref1 : false;
954
+ var smartTVMode = (_ref1 = options === null || options === void 0 ? void 0 : options.smartTVMode) !== null && _ref1 !== void 0 ? _ref1 : false;
955
+ var singleElementMode = (_ref2 = options === null || options === void 0 ? void 0 : options.singleElementMode) !== null && _ref2 !== void 0 ? _ref2 : false;
956
+ var debug = (_ref3 = options === null || options === void 0 ? void 0 : options.debug) !== null && _ref3 !== void 0 ? _ref3 : false;
1051
957
  var adVideoElement;
1052
958
  var adHls;
1053
959
  var adContainerEl;
@@ -1056,6 +962,7 @@ function createPrebidAdLayer(contentVideo, options) {
1056
962
  var destroyed = false;
1057
963
  var tornDown = false;
1058
964
  var trackingFired = createEmptyTrackingState();
965
+ var currentAdEventHandlers;
1059
966
  var preloadSlots = /* @__PURE__ */ new Map();
1060
967
  function emit(event, payload) {
1061
968
  var set = listeners.get(event);
@@ -1158,63 +1065,86 @@ function createPrebidAdLayer(contentVideo, options) {
1158
1065
  video.volume = 1;
1159
1066
  return video;
1160
1067
  }
1068
+ function removeAdEventListeners() {
1069
+ if (!currentAdEventHandlers || !adVideoElement) return;
1070
+ var el = adVideoElement;
1071
+ el.removeEventListener("timeupdate", currentAdEventHandlers.timeupdate);
1072
+ el.removeEventListener("playing", currentAdEventHandlers.playing);
1073
+ el.removeEventListener("ended", currentAdEventHandlers.ended);
1074
+ el.removeEventListener("error", currentAdEventHandlers.error);
1075
+ el.removeEventListener("volumechange", currentAdEventHandlers.volumechange);
1076
+ el.removeEventListener("pause", currentAdEventHandlers.pause);
1077
+ el.removeEventListener("play", currentAdEventHandlers.play);
1078
+ currentAdEventHandlers = void 0;
1079
+ }
1161
1080
  function setupAdEventListeners() {
1162
1081
  if (!adVideoElement) return;
1163
- adVideoElement.addEventListener("timeupdate", function() {
1164
- var ad = currentAd;
1165
- if (!ad || !adVideoElement) return;
1166
- var progress = adVideoElement.currentTime / ad.duration;
1167
- if (progress >= 0.25 && !trackingFired.firstQuartile) {
1168
- trackingFired.firstQuartile = true;
1169
- fireTrackingPixels2(ad.trackingUrls.firstQuartile);
1170
- }
1171
- if (progress >= 0.5 && !trackingFired.midpoint) {
1172
- trackingFired.midpoint = true;
1173
- fireTrackingPixels2(ad.trackingUrls.midpoint);
1174
- }
1175
- if (progress >= 0.75 && !trackingFired.thirdQuartile) {
1176
- trackingFired.thirdQuartile = true;
1177
- fireTrackingPixels2(ad.trackingUrls.thirdQuartile);
1178
- }
1179
- });
1180
- adVideoElement.addEventListener("playing", function() {
1181
- var ad = currentAd;
1182
- if (!ad || trackingFired.start) return;
1183
- trackingFired.start = true;
1184
- fireTrackingPixels2(ad.trackingUrls.start);
1185
- if (debug) console.log("".concat(LOG, " Ad started playing"));
1186
- });
1187
- adVideoElement.addEventListener("ended", function() {
1188
- if (tornDown || !currentAd || trackingFired.complete) return;
1189
- trackingFired.complete = true;
1190
- fireTrackingPixels2(currentAd.trackingUrls.complete);
1191
- if (debug) console.log("".concat(LOG, " Ad completed"));
1192
- handleAdComplete();
1193
- });
1194
- adVideoElement.addEventListener("error", function(e) {
1195
- if (tornDown) return;
1196
- console.error("".concat(LOG, " Ad video error:"), e);
1197
- if (currentAd) fireTrackingPixels2(currentAd.trackingUrls.error);
1198
- handleAdError();
1199
- });
1200
- adVideoElement.addEventListener("volumechange", function() {
1201
- if (!currentAd || !adVideoElement) return;
1202
- if (adVideoElement.muted) {
1203
- fireTrackingPixels2(currentAd.trackingUrls.mute);
1204
- } else {
1205
- fireTrackingPixels2(currentAd.trackingUrls.unmute);
1206
- }
1207
- });
1208
- adVideoElement.addEventListener("pause", function() {
1209
- if (currentAd && adVideoElement && !adVideoElement.ended) {
1210
- fireTrackingPixels2(currentAd.trackingUrls.pause);
1211
- }
1212
- });
1213
- adVideoElement.addEventListener("play", function() {
1214
- if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
1215
- fireTrackingPixels2(currentAd.trackingUrls.resume);
1082
+ removeAdEventListeners();
1083
+ var handlers = {
1084
+ timeupdate: function timeupdate() {
1085
+ var ad = currentAd;
1086
+ if (!ad || !adVideoElement) return;
1087
+ var progress = adVideoElement.currentTime / ad.duration;
1088
+ if (progress >= 0.25 && !trackingFired.firstQuartile) {
1089
+ trackingFired.firstQuartile = true;
1090
+ fireTrackingPixels2(ad.trackingUrls.firstQuartile);
1091
+ }
1092
+ if (progress >= 0.5 && !trackingFired.midpoint) {
1093
+ trackingFired.midpoint = true;
1094
+ fireTrackingPixels2(ad.trackingUrls.midpoint);
1095
+ }
1096
+ if (progress >= 0.75 && !trackingFired.thirdQuartile) {
1097
+ trackingFired.thirdQuartile = true;
1098
+ fireTrackingPixels2(ad.trackingUrls.thirdQuartile);
1099
+ }
1100
+ },
1101
+ playing: function playing() {
1102
+ var ad = currentAd;
1103
+ if (!ad || trackingFired.start) return;
1104
+ trackingFired.start = true;
1105
+ fireTrackingPixels2(ad.trackingUrls.start);
1106
+ if (debug) console.log("".concat(LOG, " Ad started playing"));
1107
+ },
1108
+ ended: function ended() {
1109
+ if (tornDown || !currentAd || trackingFired.complete) return;
1110
+ trackingFired.complete = true;
1111
+ fireTrackingPixels2(currentAd.trackingUrls.complete);
1112
+ if (debug) console.log("".concat(LOG, " Ad completed"));
1113
+ handleAdComplete();
1114
+ },
1115
+ error: function error(e) {
1116
+ if (tornDown) return;
1117
+ console.error("".concat(LOG, " Ad video error:"), e);
1118
+ if (currentAd) fireTrackingPixels2(currentAd.trackingUrls.error);
1119
+ handleAdError();
1120
+ },
1121
+ volumechange: function volumechange() {
1122
+ if (!currentAd || !adVideoElement) return;
1123
+ if (adVideoElement.muted) {
1124
+ fireTrackingPixels2(currentAd.trackingUrls.mute);
1125
+ } else {
1126
+ fireTrackingPixels2(currentAd.trackingUrls.unmute);
1127
+ }
1128
+ },
1129
+ pause: function pause() {
1130
+ if (currentAd && adVideoElement && !adVideoElement.ended) {
1131
+ fireTrackingPixels2(currentAd.trackingUrls.pause);
1132
+ }
1133
+ },
1134
+ play: function play() {
1135
+ if (currentAd && adVideoElement && adVideoElement.currentTime > 0) {
1136
+ fireTrackingPixels2(currentAd.trackingUrls.resume);
1137
+ }
1216
1138
  }
1217
- });
1139
+ };
1140
+ adVideoElement.addEventListener("timeupdate", handlers.timeupdate);
1141
+ adVideoElement.addEventListener("playing", handlers.playing);
1142
+ adVideoElement.addEventListener("ended", handlers.ended);
1143
+ adVideoElement.addEventListener("error", handlers.error);
1144
+ adVideoElement.addEventListener("volumechange", handlers.volumechange);
1145
+ adVideoElement.addEventListener("pause", handlers.pause);
1146
+ adVideoElement.addEventListener("play", handlers.play);
1147
+ currentAdEventHandlers = handlers;
1218
1148
  }
1219
1149
  function setAdPlayingFlag(isPlaying) {
1220
1150
  if (isPlaying) {
@@ -1237,6 +1167,7 @@ function createPrebidAdLayer(contentVideo, options) {
1237
1167
  }
1238
1168
  function handleAdError() {
1239
1169
  if (tornDown) return;
1170
+ if (!adPlaying) return;
1240
1171
  if (debug) console.log("".concat(LOG, " Handling ad error"));
1241
1172
  adPlaying = false;
1242
1173
  setAdPlayingFlag(false);
@@ -1247,14 +1178,19 @@ function createPrebidAdLayer(contentVideo, options) {
1247
1178
  emit("ad_error");
1248
1179
  }
1249
1180
  function teardownCurrentPlayback() {
1181
+ removeAdEventListeners();
1250
1182
  if (adHls) {
1251
1183
  adHls.destroy();
1252
1184
  adHls = void 0;
1253
1185
  }
1254
1186
  if (adVideoElement) {
1255
- adVideoElement.pause();
1256
- adVideoElement.removeAttribute("src");
1257
- adVideoElement.load();
1187
+ if (singleElementMode && adVideoElement === contentVideo) {
1188
+ contentVideo.pause();
1189
+ } else {
1190
+ adVideoElement.pause();
1191
+ adVideoElement.removeAttribute("src");
1192
+ adVideoElement.load();
1193
+ }
1258
1194
  }
1259
1195
  }
1260
1196
  function startNativePlayback(mediaFile) {
@@ -1287,8 +1223,17 @@ function createPrebidAdLayer(contentVideo, options) {
1287
1223
  handleAdError();
1288
1224
  });
1289
1225
  });
1226
+ var nonFatalNetworkErrors = 0;
1290
1227
  adHls.on(Hls.Events.ERROR, function(_event, data) {
1291
- if (data.fatal) handleAdError();
1228
+ if (data.fatal) {
1229
+ handleAdError();
1230
+ } else if (data.type === Hls.ErrorTypes.NETWORK_ERROR) {
1231
+ nonFatalNetworkErrors++;
1232
+ if (nonFatalNetworkErrors >= 3) {
1233
+ if (debug) console.warn("".concat(LOG, " Too many non-fatal HLS network errors (").concat(nonFatalNetworkErrors, "), treating as fatal"));
1234
+ handleAdError();
1235
+ }
1236
+ }
1292
1237
  });
1293
1238
  } else if (adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
1294
1239
  adVideoElement.src = mediaFile.url;
@@ -1311,7 +1256,7 @@ function createPrebidAdLayer(contentVideo, options) {
1311
1256
  }
1312
1257
  function playAd(bids) {
1313
1258
  return _async_to_generator(function() {
1314
- var winner, ad, _contentVideo_parentElement, container, contentVolume, adVolume, mediaFile;
1259
+ var winner, ad, contentVolume, _contentVideo_parentElement, container, adVolume, mediaFile;
1315
1260
  return _ts_generator(this, function(_state) {
1316
1261
  switch(_state.label){
1317
1262
  case 0:
@@ -1353,32 +1298,40 @@ function createPrebidAdLayer(contentVideo, options) {
1353
1298
  trackingFired = _object_spread({}, createEmptyTrackingState());
1354
1299
  fireTrackingPixels2(ad.trackingUrls.impression);
1355
1300
  trackingFired.impression = true;
1356
- if (!adContainerEl) {
1357
- ;
1358
- container = document.createElement("div");
1359
- container.style.position = "absolute";
1360
- container.style.left = "0";
1361
- container.style.top = "0";
1362
- container.style.right = "0";
1363
- container.style.bottom = "0";
1364
- container.style.display = "none";
1365
- container.style.alignItems = "center";
1366
- container.style.justifyContent = "center";
1367
- container.style.pointerEvents = "none";
1368
- container.style.zIndex = "10";
1369
- container.style.backgroundColor = "#000";
1370
- (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1371
- adContainerEl = container;
1372
- }
1373
- if (!adVideoElement) {
1374
- adVideoElement = createAdVideoElement();
1375
- adContainerEl.appendChild(adVideoElement);
1301
+ contentVolume = contentVideo.volume;
1302
+ originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1303
+ if (singleElementMode) {
1304
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1305
+ teardownCurrentPlayback();
1306
+ adVideoElement = contentVideo;
1307
+ adHls = void 0;
1376
1308
  setupAdEventListeners();
1377
1309
  } else {
1378
- teardownCurrentPlayback();
1310
+ if (!adContainerEl) {
1311
+ ;
1312
+ container = document.createElement("div");
1313
+ container.style.position = "absolute";
1314
+ container.style.left = "0";
1315
+ container.style.top = "0";
1316
+ container.style.right = "0";
1317
+ container.style.bottom = "0";
1318
+ container.style.display = "none";
1319
+ container.style.alignItems = "center";
1320
+ container.style.justifyContent = "center";
1321
+ container.style.pointerEvents = "none";
1322
+ container.style.zIndex = "10";
1323
+ container.style.backgroundColor = "#000";
1324
+ (_contentVideo_parentElement = contentVideo.parentElement) === null || _contentVideo_parentElement === void 0 ? void 0 : _contentVideo_parentElement.appendChild(container);
1325
+ adContainerEl = container;
1326
+ }
1327
+ if (!adVideoElement) {
1328
+ adVideoElement = createAdVideoElement();
1329
+ adContainerEl.appendChild(adVideoElement);
1330
+ setupAdEventListeners();
1331
+ } else {
1332
+ teardownCurrentPlayback();
1333
+ }
1379
1334
  }
1380
- contentVolume = contentVideo.volume;
1381
- originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1382
1335
  if (!continueLiveStreamDuringAds) {
1383
1336
  contentVideo.pause();
1384
1337
  }
@@ -1389,7 +1342,7 @@ function createPrebidAdLayer(contentVideo, options) {
1389
1342
  adVolume = originalMutedState ? 1 : originalVolume;
1390
1343
  adVideoElement.volume = Math.max(0, Math.min(1, adVolume));
1391
1344
  adVideoElement.muted = false;
1392
- if (adContainerEl) {
1345
+ if (!singleElementMode && adContainerEl) {
1393
1346
  adContainerEl.style.display = "flex";
1394
1347
  adContainerEl.style.pointerEvents = "auto";
1395
1348
  }
@@ -1426,7 +1379,7 @@ function createPrebidAdLayer(contentVideo, options) {
1426
1379
  }
1427
1380
  function preloadAd(bids, token) {
1428
1381
  return _async_to_generator(function() {
1429
- var winner, ad, mediaFile, videoEl, container, hls, slot, slot1;
1382
+ var winner, ad, mediaFile, slot, videoEl, container, hls, slot1, slot2;
1430
1383
  return _ts_generator(this, function(_state) {
1431
1384
  switch(_state.label){
1432
1385
  case 0:
@@ -1451,6 +1404,20 @@ function createPrebidAdLayer(contentVideo, options) {
1451
1404
  if (!mediaFile) return [
1452
1405
  2
1453
1406
  ];
1407
+ if (smartTVMode || singleElementMode) {
1408
+ slot = {
1409
+ bids: bids,
1410
+ ad: ad,
1411
+ mediaFile: mediaFile,
1412
+ videoEl: null,
1413
+ ready: true
1414
+ };
1415
+ preloadSlots.set(token, slot);
1416
+ if (debug) console.log("".concat(LOG, " [preload] Metadata-only preload (smartTV/singleElement), token=").concat(token, ", url=").concat(mediaFile.url));
1417
+ return [
1418
+ 2
1419
+ ];
1420
+ }
1454
1421
  videoEl = createAdVideoElement();
1455
1422
  videoEl.style.visibility = "hidden";
1456
1423
  videoEl.style.pointerEvents = "none";
@@ -1464,7 +1431,7 @@ function createPrebidAdLayer(contentVideo, options) {
1464
1431
  });
1465
1432
  hls.loadSource(mediaFile.url);
1466
1433
  hls.attachMedia(videoEl);
1467
- slot = {
1434
+ slot1 = {
1468
1435
  bids: bids,
1469
1436
  ad: ad,
1470
1437
  mediaFile: mediaFile,
@@ -1472,7 +1439,7 @@ function createPrebidAdLayer(contentVideo, options) {
1472
1439
  hlsInstance: hls,
1473
1440
  ready: false
1474
1441
  };
1475
- preloadSlots.set(token, slot);
1442
+ preloadSlots.set(token, slot1);
1476
1443
  hls.on(Hls.Events.MANIFEST_PARSED, function() {
1477
1444
  var s = preloadSlots.get(token);
1478
1445
  if (s) s.ready = true;
@@ -1489,14 +1456,14 @@ function createPrebidAdLayer(contentVideo, options) {
1489
1456
  } else {
1490
1457
  videoEl.src = mediaFile.url;
1491
1458
  videoEl.load();
1492
- slot1 = {
1459
+ slot2 = {
1493
1460
  bids: bids,
1494
1461
  ad: ad,
1495
1462
  mediaFile: mediaFile,
1496
1463
  videoEl: videoEl,
1497
1464
  ready: false
1498
1465
  };
1499
- preloadSlots.set(token, slot1);
1466
+ preloadSlots.set(token, slot2);
1500
1467
  videoEl.addEventListener("canplay", function() {
1501
1468
  var s = preloadSlots.get(token);
1502
1469
  if (s) s.ready = true;
@@ -1515,7 +1482,7 @@ function createPrebidAdLayer(contentVideo, options) {
1515
1482
  }
1516
1483
  function playPreloaded(token) {
1517
1484
  return _async_to_generator(function() {
1518
- var slot, contentVolume, adVolume, container;
1485
+ var slot, contentVolume, adVolume2, videoEl, container2, adVolume21, adVolume, container;
1519
1486
  return _ts_generator(this, function(_state) {
1520
1487
  if (destroyed) return [
1521
1488
  2,
@@ -1530,6 +1497,68 @@ function createPrebidAdLayer(contentVideo, options) {
1530
1497
  }
1531
1498
  preloadSlots.delete(token);
1532
1499
  if (debug) console.log("".concat(LOG, " [preload] Playing preloaded ad, token=").concat(token, ", ready=").concat(slot.ready));
1500
+ contentVolume = contentVideo.volume;
1501
+ originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1502
+ sessionId = generateSessionId();
1503
+ currentAd = slot.ad;
1504
+ trackingFired = _object_spread({}, createEmptyTrackingState());
1505
+ fireTrackingPixels2(slot.ad.trackingUrls.impression);
1506
+ trackingFired.impression = true;
1507
+ if (singleElementMode) {
1508
+ mainHlsInstance === null || mainHlsInstance === void 0 ? void 0 : mainHlsInstance.detachMedia();
1509
+ teardownCurrentPlayback();
1510
+ adVideoElement = contentVideo;
1511
+ adHls = void 0;
1512
+ setupAdEventListeners();
1513
+ if (!continueLiveStreamDuringAds) {
1514
+ contentVideo.pause();
1515
+ }
1516
+ contentVideo.muted = true;
1517
+ contentVideo.volume = 0;
1518
+ adPlaying = true;
1519
+ setAdPlayingFlag(true);
1520
+ adVolume2 = originalMutedState ? 1 : originalVolume;
1521
+ contentVideo.volume = Math.max(0, Math.min(1, adVolume2));
1522
+ contentVideo.muted = false;
1523
+ emit("content_pause");
1524
+ if (debug) console.log("".concat(LOG, " [preload] singleElementMode: attaching ad to contentVideo, url=").concat(slot.mediaFile.url));
1525
+ startPlayback(slot.mediaFile);
1526
+ return [
1527
+ 2
1528
+ ];
1529
+ }
1530
+ if (smartTVMode && !slot.videoEl) {
1531
+ teardownCurrentPlayback();
1532
+ if (adVideoElement) {
1533
+ adVideoElement.remove();
1534
+ adVideoElement = void 0;
1535
+ }
1536
+ videoEl = createAdVideoElement();
1537
+ videoEl.style.visibility = "visible";
1538
+ videoEl.style.pointerEvents = "none";
1539
+ container2 = ensureAdContainer();
1540
+ container2.appendChild(videoEl);
1541
+ adVideoElement = videoEl;
1542
+ setupAdEventListeners();
1543
+ if (!continueLiveStreamDuringAds) {
1544
+ contentVideo.pause();
1545
+ }
1546
+ contentVideo.muted = true;
1547
+ contentVideo.volume = 0;
1548
+ adPlaying = true;
1549
+ setAdPlayingFlag(true);
1550
+ adVolume21 = originalMutedState ? 1 : originalVolume;
1551
+ adVideoElement.volume = Math.max(0, Math.min(1, adVolume21));
1552
+ adVideoElement.muted = false;
1553
+ container2.style.display = "flex";
1554
+ container2.style.pointerEvents = "auto";
1555
+ emit("content_pause");
1556
+ if (debug) console.log("".concat(LOG, " [preload] smartTVMode deferred: creating video element and loading, url=").concat(slot.mediaFile.url));
1557
+ startPlayback(slot.mediaFile);
1558
+ return [
1559
+ 2
1560
+ ];
1561
+ }
1533
1562
  teardownCurrentPlayback();
1534
1563
  if (adVideoElement && adVideoElement !== slot.videoEl) {
1535
1564
  adVideoElement.remove();
@@ -1539,13 +1568,6 @@ function createPrebidAdLayer(contentVideo, options) {
1539
1568
  adVideoElement = slot.videoEl;
1540
1569
  adHls = slot.hlsInstance;
1541
1570
  setupAdEventListeners();
1542
- sessionId = generateSessionId();
1543
- currentAd = slot.ad;
1544
- trackingFired = _object_spread({}, createEmptyTrackingState());
1545
- fireTrackingPixels2(slot.ad.trackingUrls.impression);
1546
- trackingFired.impression = true;
1547
- contentVolume = contentVideo.volume;
1548
- originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1549
1571
  if (!continueLiveStreamDuringAds) {
1550
1572
  contentVideo.pause();
1551
1573
  }
@@ -1560,17 +1582,10 @@ function createPrebidAdLayer(contentVideo, options) {
1560
1582
  container.style.display = "flex";
1561
1583
  container.style.pointerEvents = "auto";
1562
1584
  emit("content_pause");
1563
- if (slot.hlsInstance) {
1564
- adVideoElement.play().catch(function(error) {
1565
- console.error("".concat(LOG, " [preload] Error playing preloaded HLS ad:"), error);
1566
- handleAdError();
1567
- });
1568
- } else {
1569
- adVideoElement.play().catch(function(error) {
1570
- console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1571
- handleAdError();
1572
- });
1573
- }
1585
+ adVideoElement.play().catch(function(error) {
1586
+ console.error("".concat(LOG, " [preload] Error playing preloaded ad:"), error);
1587
+ handleAdError();
1588
+ });
1574
1589
  return [
1575
1590
  2
1576
1591
  ];
@@ -1584,10 +1599,12 @@ function createPrebidAdLayer(contentVideo, options) {
1584
1599
  if (slot.hlsInstance) {
1585
1600
  slot.hlsInstance.destroy();
1586
1601
  }
1587
- slot.videoEl.pause();
1588
- slot.videoEl.removeAttribute("src");
1589
- slot.videoEl.load();
1590
- slot.videoEl.remove();
1602
+ if (slot.videoEl) {
1603
+ slot.videoEl.pause();
1604
+ slot.videoEl.removeAttribute("src");
1605
+ slot.videoEl.load();
1606
+ slot.videoEl.remove();
1607
+ }
1591
1608
  if (debug) console.log("".concat(LOG, " [preload] Cancelled and cleaned up token=").concat(token));
1592
1609
  }
1593
1610
  return {
@@ -1635,20 +1652,27 @@ function createPrebidAdLayer(contentVideo, options) {
1635
1652
  setAdPlayingFlag(false);
1636
1653
  contentVideo.muted = originalMutedState;
1637
1654
  contentVideo.volume = originalMutedState ? 0 : originalVolume;
1638
- if (adContainerEl) {
1639
- adContainerEl.style.display = "none";
1640
- adContainerEl.style.pointerEvents = "none";
1641
- }
1642
1655
  contentVideo.style.visibility = "visible";
1643
1656
  contentVideo.style.opacity = "1";
1644
- if (continueLiveStreamDuringAds) {
1645
- contentVideo.play().catch(function() {});
1646
- }
1647
- teardownCurrentPlayback();
1648
- if (adVideoElement) {
1649
- adVideoElement.pause();
1650
- adVideoElement.removeAttribute("src");
1651
- adVideoElement.load();
1657
+ if (singleElementMode) {
1658
+ teardownCurrentPlayback();
1659
+ contentVideo.removeAttribute("src");
1660
+ contentVideo.load();
1661
+ adVideoElement = void 0;
1662
+ } else {
1663
+ if (adContainerEl) {
1664
+ adContainerEl.style.display = "none";
1665
+ adContainerEl.style.pointerEvents = "none";
1666
+ }
1667
+ if (continueLiveStreamDuringAds) {
1668
+ contentVideo.play().catch(function() {});
1669
+ }
1670
+ teardownCurrentPlayback();
1671
+ if (adVideoElement) {
1672
+ adVideoElement.pause();
1673
+ adVideoElement.removeAttribute("src");
1674
+ adVideoElement.load();
1675
+ }
1652
1676
  }
1653
1677
  currentAd = void 0;
1654
1678
  tornDown = false;
@@ -1688,9 +1712,14 @@ function createPrebidAdLayer(contentVideo, options) {
1688
1712
  }
1689
1713
  teardownCurrentPlayback();
1690
1714
  if (adVideoElement) {
1691
- adVideoElement.pause();
1692
- adVideoElement.removeAttribute("src");
1693
- adVideoElement.remove();
1715
+ if (singleElementMode && adVideoElement === contentVideo) {
1716
+ contentVideo.removeAttribute("src");
1717
+ contentVideo.load();
1718
+ } else {
1719
+ adVideoElement.pause();
1720
+ adVideoElement.removeAttribute("src");
1721
+ adVideoElement.remove();
1722
+ }
1694
1723
  adVideoElement = void 0;
1695
1724
  }
1696
1725
  if (adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.parentElement) {
@@ -2913,11 +2942,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2913
2942
  this.video = config.videoElement;
2914
2943
  this.adTransitionGapMs = (_this_config_adTransitionGapMs = this.config.adTransitionGapMs) !== null && _this_config_adTransitionGapMs !== void 0 ? _this_config_adTransitionGapMs : 100;
2915
2944
  logBrowserInfo(config.debugAdTiming);
2916
- this.prebidManager = createPrebidManager(config.debugAdTiming !== void 0 ? {
2945
+ this.vastManager = createVastManager(config.debugAdTiming !== void 0 ? {
2917
2946
  debug: !!config.debugAdTiming
2918
2947
  } : {});
2919
- this.adLayer = createPrebidAdLayer(this.video, {
2948
+ var browserForAdLayer = detectBrowser();
2949
+ this.adLayer = createVastAdLayer(this.video, {
2920
2950
  continueLiveStreamDuringAds: false,
2951
+ smartTVMode: browserForAdLayer.isSmartTV,
2952
+ singleElementMode: browserForAdLayer.isSmartTV,
2921
2953
  debug: !!config.debugAdTiming
2922
2954
  });
2923
2955
  }
@@ -2929,19 +2961,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2929
2961
  return _ts_generator(this, function(_state) {
2930
2962
  switch(_state.label){
2931
2963
  case 0:
2932
- if (this.config.disablePrebid) return [
2964
+ if (this.config.disableAds) return [
2933
2965
  2,
2934
2966
  []
2935
2967
  ];
2936
2968
  return [
2937
2969
  4,
2938
- this.prebidManager.initialize()
2970
+ this.vastManager.initialize()
2939
2971
  ];
2940
2972
  case 1:
2941
2973
  _state.sent();
2942
2974
  return [
2943
2975
  2,
2944
- this.prebidManager.requestBidsUntilResponse(context)
2976
+ this.vastManager.requestBidsUntilResponse(context)
2945
2977
  ];
2946
2978
  }
2947
2979
  });
@@ -2976,7 +3008,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2976
3008
  adBehavior: "vod (main video pauses during ads)"
2977
3009
  });
2978
3010
  }
2979
- if (!this.config.disablePrebid) {
3011
+ if (!this.config.disableAds) {
2980
3012
  this.adLayer.updateOptions({
2981
3013
  continueLiveStreamDuringAds: false,
2982
3014
  mainHlsInstance: null
@@ -3044,7 +3076,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3044
3076
  adBehavior: adBehavior
3045
3077
  });
3046
3078
  }
3047
- if (!this.config.disablePrebid) {
3079
+ if (!this.config.disableAds) {
3048
3080
  ;
3049
3081
  this.adLayer.updateOptions({
3050
3082
  continueLiveStreamDuringAds: this.shouldContinueLiveStreamDuringAds(),
@@ -3365,7 +3397,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3365
3397
  {
3366
3398
  key: "getAdSource",
3367
3399
  value: function getAdSource() {
3368
- return "prebid";
3400
+ return "vast";
3369
3401
  }
3370
3402
  },
3371
3403
  {
@@ -3611,7 +3643,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3611
3643
  this.attached = true;
3612
3644
  this.video.autoplay = !!this.config.autoplay;
3613
3645
  this.video.muted = !!this.config.muted;
3614
- if (!this.config.disablePrebid) {
3646
+ if (!this.config.disableAds) {
3615
3647
  this.adLayer.initialize();
3616
3648
  if (!this.config.disableFiller) {
3617
3649
  this.ensureFillerVideo();
@@ -3807,7 +3839,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3807
3839
  key: "onScte35Marker",
3808
3840
  value: function onScte35Marker(marker) {
3809
3841
  var _this = this;
3810
- if (this.config.disablePrebid) return;
3842
+ if (this.config.disableAds) return;
3811
3843
  if (this.config.debugAdTiming) {
3812
3844
  console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
3813
3845
  type: marker.type,
@@ -4279,13 +4311,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4279
4311
  if (!this.isLiveStream) {
4280
4312
  return false;
4281
4313
  }
4314
+ var browser = detectBrowser();
4315
+ if (browser.isSmartTV) {
4316
+ return false;
4317
+ }
4282
4318
  return true;
4283
4319
  }
4284
4320
  },
4285
4321
  {
4286
4322
  key: "startAdPrefetch",
4287
4323
  value: function startAdPrefetch(marker, fragmentSn) {
4288
- if (this.config.disablePrebid) return;
4324
+ if (this.config.disableAds) return;
4289
4325
  if (this.pendingAdBreak || this.inAdBreak) {
4290
4326
  return;
4291
4327
  }
@@ -4307,25 +4343,75 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4307
4343
  key: "runAdPrefetch",
4308
4344
  value: function runAdPrefetch(marker) {
4309
4345
  return _async_to_generator(function() {
4310
- var _this, _marker_durationSeconds, durSec, estimatedCount, context, fetches, results, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, result, token;
4346
+ var _this, _marker_durationSeconds, _ref, _firstBids_, durSec, context, firstBids, unused, adDurationSec, estimatedCount, firstToken, remaining, results, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, result, token;
4311
4347
  return _ts_generator(this, function(_state) {
4312
4348
  switch(_state.label){
4313
4349
  case 0:
4314
4350
  _this = this;
4315
4351
  durSec = (_marker_durationSeconds = marker.durationSeconds) !== null && _marker_durationSeconds !== void 0 ? _marker_durationSeconds : 60;
4316
- estimatedCount = Math.min(4, Math.max(1, Math.ceil(durSec / 30)));
4317
- if (this.config.debugAdTiming) {
4318
- console.log("[PREFETCH] Firing ".concat(estimatedCount, " parallel bid request(s) for ").concat(durSec, "s break"));
4319
- }
4320
4352
  context = {
4321
4353
  breakDurationSec: durSec,
4322
4354
  remainingBreakSec: durSec
4323
4355
  };
4324
- fetches = Array.from({
4325
- length: estimatedCount
4356
+ _state.label = 1;
4357
+ case 1:
4358
+ _state.trys.push([
4359
+ 1,
4360
+ 3,
4361
+ ,
4362
+ 4
4363
+ ]);
4364
+ return [
4365
+ 4,
4366
+ this.adRequest(_object_spread_props(_object_spread({}, context), {
4367
+ adIndex: 1
4368
+ }))
4369
+ ];
4370
+ case 2:
4371
+ firstBids = _state.sent();
4372
+ return [
4373
+ 3,
4374
+ 4
4375
+ ];
4376
+ case 3:
4377
+ unused = _state.sent();
4378
+ firstBids = [];
4379
+ return [
4380
+ 3,
4381
+ 4
4382
+ ];
4383
+ case 4:
4384
+ if (this.inAdBreak) return [
4385
+ 2
4386
+ ];
4387
+ if (firstBids.length === 0) {
4388
+ if (this.config.debugAdTiming) {
4389
+ console.log("[PREFETCH] First VAST request returned no ad, aborting prefetch");
4390
+ }
4391
+ return [
4392
+ 2
4393
+ ];
4394
+ }
4395
+ adDurationSec = (_ref = (_firstBids_ = firstBids[0]) === null || _firstBids_ === void 0 ? void 0 : _firstBids_.durationSec) !== null && _ref !== void 0 ? _ref : 30;
4396
+ estimatedCount = Math.max(1, Math.ceil(durSec / adDurationSec));
4397
+ if (this.config.debugAdTiming) {
4398
+ console.log("[PREFETCH] Ad duration=".concat(adDurationSec, "s, break=").concat(durSec, "s → ").concat(estimatedCount, " ad(s) needed"));
4399
+ }
4400
+ firstToken = "preload_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 7));
4401
+ this.preloadedTokens.push(firstToken);
4402
+ void this.adLayer.preloadAd(firstBids, firstToken);
4403
+ if (this.config.debugAdTiming) {
4404
+ console.log("[PREFETCH] First ad preloading, token=".concat(firstToken));
4405
+ }
4406
+ if (!(estimatedCount > 1)) return [
4407
+ 3,
4408
+ 6
4409
+ ];
4410
+ remaining = Array.from({
4411
+ length: estimatedCount - 1
4326
4412
  }, function(_, i) {
4327
4413
  return _this.adRequest(_object_spread_props(_object_spread({}, context), {
4328
- adIndex: i + 1
4414
+ adIndex: i + 2
4329
4415
  })).then(function(bids) {
4330
4416
  return {
4331
4417
  ok: true,
@@ -4339,9 +4425,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4339
4425
  });
4340
4426
  return [
4341
4427
  4,
4342
- Promise.all(fetches)
4428
+ Promise.all(remaining)
4343
4429
  ];
4344
- case 1:
4430
+ case 5:
4345
4431
  results = _state.sent();
4346
4432
  _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4347
4433
  try {
@@ -4353,7 +4439,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4353
4439
  this.preloadedTokens.push(token);
4354
4440
  void this.adLayer.preloadAd(result.value, token);
4355
4441
  if (this.config.debugAdTiming) {
4356
- console.log("[PREFETCH] Bid received, preloading video token=".concat(token));
4442
+ console.log("[PREFETCH] Additional ad preloading, token=".concat(token));
4357
4443
  }
4358
4444
  }
4359
4445
  }
@@ -4371,6 +4457,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4371
4457
  }
4372
4458
  }
4373
4459
  }
4460
+ _state.label = 6;
4461
+ case 6:
4374
4462
  if (this.config.debugAdTiming) {
4375
4463
  console.log("[PREFETCH] Pre-fetch complete: ".concat(this.preloadedTokens.length, " ad(s) queued"));
4376
4464
  }
@@ -4434,7 +4522,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4434
4522
  switch(_state.label){
4435
4523
  case 0:
4436
4524
  _loop = function() {
4437
- var remaining, prefetchContext, bids, err, bids1, remainingNow, delay, elapsed, remaining1, context, bids2, remainingNow1, err1;
4525
+ var remaining, prefetchContext, bids, err, bids1, remainingNow, urgentNeedAd, delay, elapsed, remaining1, context, bids2, remainingNow1, err1, sleepMs;
4438
4526
  return _ts_generator(this, function(_state) {
4439
4527
  switch(_state.label){
4440
4528
  case 0:
@@ -4485,6 +4573,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4485
4573
  if (bids.length > 0) {
4486
4574
  _this.consecutiveFailures = 0;
4487
4575
  _this.pendingNextAdBids = bids;
4576
+ _this.totalAdsInBreak = Math.max(_this.totalAdsInBreak, _this.currentAdIndex + _this.preloadedTokens.length + 1);
4488
4577
  if (_this.config.debugAdTiming) {
4489
4578
  console.log("[CONTINUOUS-FETCH] Pre-fetched next ad stored as pending");
4490
4579
  }
@@ -4569,7 +4658,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4569
4658
  "continue"
4570
4659
  ];
4571
4660
  case 12:
4572
- delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (_this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
4661
+ urgentNeedAd = _this.inAdBreak && !_this.adLayer.isAdPlaying();
4662
+ delay = _this.lastAdRequestTime ? _this.minAdRequestIntervalMs + (!urgentNeedAd && _this.consecutiveFailures > 0 ? backoffMs() : 0) : 0;
4573
4663
  elapsed = Date.now() - _this.lastAdRequestTime;
4574
4664
  if (!(elapsed < delay && _this.lastAdRequestTime > 0)) return [
4575
4665
  3,
@@ -4624,6 +4714,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4624
4714
  17
4625
4715
  ];
4626
4716
  _this.pendingNextAdBids = bids2;
4717
+ _this.totalAdsInBreak = Math.max(_this.totalAdsInBreak, _this.currentAdIndex + _this.preloadedTokens.length + 1);
4627
4718
  if (_this.config.debugAdTiming) {
4628
4719
  console.log("[CONTINUOUS-FETCH] Next ad response stored (ad currently playing or in transition)");
4629
4720
  }
@@ -4687,10 +4778,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4687
4778
  24
4688
4779
  ];
4689
4780
  case 24:
4781
+ sleepMs = _this.inAdBreak && !_this.adLayer.isAdPlaying() ? 0 : backoffMs();
4690
4782
  return [
4691
4783
  4,
4692
4784
  new Promise(function(r) {
4693
- return setTimeout(r, backoffMs());
4785
+ return setTimeout(r, sleepMs);
4694
4786
  })
4695
4787
  ];
4696
4788
  case 25:
@@ -4777,7 +4869,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4777
4869
  this.inAdBreak = true;
4778
4870
  this.currentAdBreakStartWallClockMs = Date.now();
4779
4871
  this.currentAdIndex = 0;
4780
- this.totalAdsInBreak = 1;
4872
+ this.totalAdsInBreak = Math.max(1, this.preloadedTokens.length);
4781
4873
  this.adPodQueue = [];
4782
4874
  if (!this.config.disableFiller) this.showAds = true;
4783
4875
  if (adBreakDurationMs != null) {
@@ -5002,6 +5094,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5002
5094
  3
5003
5095
  ];
5004
5096
  this.pendingNextAdBids = bids;
5097
+ this.totalAdsInBreak = Math.max(this.totalAdsInBreak, this.currentAdIndex + this.preloadedTokens.length);
5005
5098
  return [
5006
5099
  3,
5007
5100
  5
@@ -5370,40 +5463,45 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5370
5463
  var browser = detectBrowser();
5371
5464
  var isSmartTV = browser.tizenVersion !== void 0 || browser.webOSVersion !== void 0;
5372
5465
  if (isSmartTV && this.hls) {
5373
- if (!restoredMuted) {
5374
- var hlsRef = this.hls;
5375
- var savedMuted = restoredMuted;
5376
- var savedVolume = restoredVolume;
5377
- var onManifestParsedRestore = function onManifestParsedRestore1() {
5378
- hlsRef.off(Hls2.Events.MANIFEST_PARSED, onManifestParsedRestore);
5379
- if (!_this.inAdBreak && !_this.adLayer.isAdPlaying()) {
5380
- if (_this.video.muted !== savedMuted) _this.video.muted = savedMuted;
5381
- if (Math.abs(_this.video.volume - savedVolume) > 0.01) _this.video.volume = savedVolume;
5382
- if (_this.config.debugAdTiming) {
5383
- console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
5384
- }
5466
+ var hlsRef = this.hls;
5467
+ var savedMuted = restoredMuted;
5468
+ var savedVolume = restoredVolume;
5469
+ var onManifestParsedRestore = function onManifestParsedRestore1() {
5470
+ hlsRef.off(Hls2.Events.MANIFEST_PARSED, onManifestParsedRestore);
5471
+ if (!_this.inAdBreak && !_this.adLayer.isAdPlaying()) {
5472
+ var _this_video_play;
5473
+ if (_this.video.muted !== savedMuted) _this.video.muted = savedMuted;
5474
+ if (Math.abs(_this.video.volume - savedVolume) > 0.01) _this.video.volume = savedVolume;
5475
+ if (_this.config.debugAdTiming) {
5476
+ console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
5385
5477
  }
5386
- };
5387
- hlsRef.on(Hls2.Events.MANIFEST_PARSED, onManifestParsedRestore);
5388
- }
5478
+ hlsRef.startLoad(-1);
5479
+ (_this_video_play = _this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
5480
+ if (_this.config.debugAdTiming) {
5481
+ console.log("[StormcloudVideoPlayer] Smart TV: seeking to live edge and resuming playback after re-attach");
5482
+ }
5483
+ }
5484
+ };
5485
+ hlsRef.on(Hls2.Events.MANIFEST_PARSED, onManifestParsedRestore);
5389
5486
  this.hls.attachMedia(this.video);
5390
5487
  if (this.config.debugAdTiming) {
5391
5488
  console.log("[StormcloudVideoPlayer] Smart TV: re-attached HLS to video element after ad break to restore media pipeline");
5392
5489
  }
5393
- }
5394
- if (this.shouldContinueLiveStreamDuringAds()) {
5395
- var _this_video_play;
5396
- if (this.config.debugAdTiming) {
5397
- if (this.video.paused) {
5398
- console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
5399
- } else {
5400
- console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
5490
+ } else {
5491
+ if (this.shouldContinueLiveStreamDuringAds()) {
5492
+ var _this_video_play;
5493
+ if (this.config.debugAdTiming) {
5494
+ if (this.video.paused) {
5495
+ console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
5496
+ } else {
5497
+ console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
5498
+ }
5401
5499
  }
5500
+ (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
5501
+ } else if (this.video.paused) {
5502
+ var _this_video_play1;
5503
+ (_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
5402
5504
  }
5403
- (_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
5404
- } else if (this.video.paused) {
5405
- var _this_video_play1;
5406
- (_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
5407
5505
  }
5408
5506
  this.syncMainContentAudioWhenVisible();
5409
5507
  if (!restoredMuted) {
@@ -5454,6 +5552,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
5454
5552
  console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max consecutive failures reached (".concat(this.consecutiveFailures, "), ending ad break gracefully"));
5455
5553
  }
5456
5554
  this.handleAdPodComplete();
5555
+ return;
5556
+ }
5557
+ if (this.inAdBreak && !this.config.disableFiller) {
5558
+ if (this.config.debugAdTiming) {
5559
+ console.log("[CONTINUOUS-FETCH] Ad failure in active break \u2014 showing filler while awaiting next ad");
5560
+ }
5561
+ this.showPlaceholderLayer();
5562
+ this.adLayer.showPlaceholder();
5457
5563
  }
5458
5564
  }
5459
5565
  },
@@ -5793,7 +5899,7 @@ var CRITICAL_PROPS = [
5793
5899
  ];
5794
5900
  var CONTROLS_HIDE_DELAY = 3e3;
5795
5901
  var StormcloudVideoPlayerComponent = React.memo(function(props) {
5796
- 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, [
5902
+ 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, [
5797
5903
  "src",
5798
5904
  "autoplay",
5799
5905
  "muted",
@@ -5819,7 +5925,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
5819
5925
  "children",
5820
5926
  "licenseKey",
5821
5927
  "minSegmentsBeforePlay",
5822
- "disablePrebid",
5928
+ "disableAds",
5823
5929
  "disableFiller"
5824
5930
  ]);
5825
5931
  var videoRef = useRef(null);
@@ -5977,7 +6083,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
5977
6083
  if (onControlClick !== void 0) cfg.onControlClick = onControlClick;
5978
6084
  if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
5979
6085
  if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
5980
- if (disablePrebid !== void 0) cfg.disablePrebid = disablePrebid;
6086
+ if (disableAds !== void 0) cfg.disableAds = disableAds;
5981
6087
  cfg.disableFiller = disableFiller !== null && disableFiller !== void 0 ? disableFiller : true;
5982
6088
  var player = new StormcloudVideoPlayer(cfg);
5983
6089
  playerRef.current = player;
@@ -7035,7 +7141,7 @@ var defaultProps = {
7035
7141
  licenseKey: "",
7036
7142
  adFailsafeTimeoutMs: 1e4,
7037
7143
  minSegmentsBeforePlay: 2,
7038
- disablePrebid: false,
7144
+ disableAds: false,
7039
7145
  disableFiller: true,
7040
7146
  onStart: noop,
7041
7147
  onPlay: noop,
@@ -7219,7 +7325,7 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
7219
7325
  if (_this1.props.licenseKey !== void 0) config.licenseKey = _this1.props.licenseKey;
7220
7326
  if (_this1.props.adFailsafeTimeoutMs !== void 0) config.adFailsafeTimeoutMs = _this1.props.adFailsafeTimeoutMs;
7221
7327
  if (_this1.props.minSegmentsBeforePlay !== void 0) config.minSegmentsBeforePlay = _this1.props.minSegmentsBeforePlay;
7222
- if (_this1.props.disablePrebid !== void 0) config.disablePrebid = _this1.props.disablePrebid;
7328
+ if (_this1.props.disableAds !== void 0) config.disableAds = _this1.props.disableAds;
7223
7329
  _this1.player = new StormcloudVideoPlayer(config);
7224
7330
  (_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
7225
7331
  return [
@@ -8169,5 +8275,5 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
8169
8275
  };
8170
8276
  var StormcloudPlayer = createStormcloudPlayer(players_default, players_default[players_default.length - 1]);
8171
8277
  var StormcloudPlayer_default = StormcloudPlayer;
8172
- export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createPrebidAdLayer, createPrebidManager, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players_default as players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode };
8278
+ export { IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, canPlay, createStormcloudPlayer, createVastAdLayer, createVastManager, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, initializePolyfills, isMediaStream, lazy, logBrowserInfo, merge, omit, parseQuery, players_default as players, randomString, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode };
8173
8279
  //# sourceMappingURL=index.js.map