stormcloud-video-player 0.3.58 → 0.3.59
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/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +841 -88
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +40 -0
- package/lib/index.d.ts +40 -0
- package/lib/index.js +841 -88
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +841 -88
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +40 -0
- package/lib/players/HlsPlayer.cjs +841 -88
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +841 -88
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +841 -88
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -3450,6 +3450,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3450
3450
|
this.adRequestQueue = [];
|
|
3451
3451
|
this.maxPlaceholderDurationMs = 5e3;
|
|
3452
3452
|
this.isShowingPlaceholder = false;
|
|
3453
|
+
this.tsScte35Pids = /* @__PURE__ */ new Set();
|
|
3454
|
+
this.pmtPids = /* @__PURE__ */ new Set();
|
|
3455
|
+
this.processedTsScte35Sections = /* @__PURE__ */ new Set();
|
|
3456
|
+
this.pendingScte35Cues = /* @__PURE__ */ new Map();
|
|
3457
|
+
this.recentScte35CueKeys = /* @__PURE__ */ new Map();
|
|
3458
|
+
this.recentScte35CueLimit = 200;
|
|
3453
3459
|
this.totalAdRequestsInBreak = 0;
|
|
3454
3460
|
this.maxTotalAdRequestsPerBreak = 10;
|
|
3455
3461
|
this.pendingAdBreak = null;
|
|
@@ -3719,7 +3725,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3719
3725
|
if (_this.config.debugAdTiming) {
|
|
3720
3726
|
console.log("[StormcloudVideoPlayer] \uD83C\uDFAF EARLY SCTE-35 DETECTION: Ad break marker found in fragment", i, "- starting pre-fetch (NOT playing yet)");
|
|
3721
3727
|
}
|
|
3722
|
-
_this.
|
|
3728
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "early", frag)));
|
|
3723
3729
|
return;
|
|
3724
3730
|
}
|
|
3725
3731
|
}
|
|
@@ -3800,10 +3806,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3800
3806
|
return _this.onId3Tag(tag);
|
|
3801
3807
|
});
|
|
3802
3808
|
});
|
|
3809
|
+
this.hls.on(import_hls2.default.Events.FRAG_LOADED, function(_evt, data) {
|
|
3810
|
+
var _data_frag;
|
|
3811
|
+
_this.processFragmentScte35Payload(data === null || data === void 0 ? void 0 : data.payload, typeof (data === null || data === void 0 ? void 0 : (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.sn) === "number" ? data.frag.sn : void 0, _this.getFragmentStartSeconds(data === null || data === void 0 ? void 0 : data.frag));
|
|
3812
|
+
});
|
|
3813
|
+
this.hls.on(import_hls2.default.Events.FRAG_DECRYPTED, function(_evt, data) {
|
|
3814
|
+
var _data_frag;
|
|
3815
|
+
_this.processFragmentScte35Payload(data === null || data === void 0 ? void 0 : data.payload, typeof (data === null || data === void 0 ? void 0 : (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.sn) === "number" ? data.frag.sn : void 0, _this.getFragmentStartSeconds(data === null || data === void 0 ? void 0 : data.frag));
|
|
3816
|
+
});
|
|
3803
3817
|
this.hls.on(import_hls2.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3804
3818
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3805
3819
|
var tagList = frag === null || frag === void 0 ? void 0 : frag.tagList;
|
|
3806
|
-
if (!Array.isArray(tagList))
|
|
3820
|
+
if (!Array.isArray(tagList)) {
|
|
3821
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3822
|
+
return;
|
|
3823
|
+
}
|
|
3807
3824
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3808
3825
|
try {
|
|
3809
3826
|
for(var _iterator = tagList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -3839,7 +3856,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3839
3856
|
value: value
|
|
3840
3857
|
}
|
|
3841
3858
|
});
|
|
3842
|
-
_this.
|
|
3859
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3843
3860
|
} else if (tag.includes("EXT-X-CUE-OUT")) {
|
|
3844
3861
|
var durationSeconds = _this.parseCueOutDuration(value);
|
|
3845
3862
|
var marker1 = _object_spread_props(_object_spread({
|
|
@@ -3852,15 +3869,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3852
3869
|
value: value
|
|
3853
3870
|
}
|
|
3854
3871
|
});
|
|
3855
|
-
_this.
|
|
3872
|
+
_this.onScte35Cue(marker1, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3856
3873
|
} else if (tag.includes("EXT-X-CUE-IN")) {
|
|
3857
|
-
_this.
|
|
3874
|
+
_this.onScte35Cue({
|
|
3858
3875
|
type: "end",
|
|
3859
3876
|
raw: {
|
|
3860
3877
|
tag: tag,
|
|
3861
3878
|
value: value
|
|
3862
3879
|
}
|
|
3863
|
-
});
|
|
3880
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3864
3881
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
3865
3882
|
var _attrs_CLASS;
|
|
3866
3883
|
var attrs = _this.parseAttributeList(value);
|
|
@@ -3880,17 +3897,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3880
3897
|
attrs: attrs
|
|
3881
3898
|
}
|
|
3882
3899
|
});
|
|
3883
|
-
_this.
|
|
3900
|
+
_this.onScte35Cue(marker2, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3884
3901
|
}
|
|
3885
3902
|
if (hasScteIn) {
|
|
3886
|
-
_this.
|
|
3903
|
+
_this.onScte35Cue({
|
|
3887
3904
|
type: "end",
|
|
3888
3905
|
raw: {
|
|
3889
3906
|
tag: tag,
|
|
3890
3907
|
value: value,
|
|
3891
3908
|
attrs: attrs
|
|
3892
3909
|
}
|
|
3893
|
-
});
|
|
3910
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3894
3911
|
}
|
|
3895
3912
|
}
|
|
3896
3913
|
}
|
|
@@ -3908,6 +3925,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3908
3925
|
}
|
|
3909
3926
|
}
|
|
3910
3927
|
}
|
|
3928
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3911
3929
|
});
|
|
3912
3930
|
this.hls.on(import_hls2.default.Events.ERROR, function(_evt, data) {
|
|
3913
3931
|
if (data === null || data === void 0 ? void 0 : data.fatal) {
|
|
@@ -4213,7 +4231,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4213
4231
|
}
|
|
4214
4232
|
var marker = this.parseScte35FromId3(tag);
|
|
4215
4233
|
if (marker) {
|
|
4216
|
-
this.
|
|
4234
|
+
this.onScte35Cue(marker, {
|
|
4235
|
+
source: "id3",
|
|
4236
|
+
readiness: "playback"
|
|
4237
|
+
});
|
|
4217
4238
|
}
|
|
4218
4239
|
}
|
|
4219
4240
|
},
|
|
@@ -4357,9 +4378,251 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4357
4378
|
}
|
|
4358
4379
|
}
|
|
4359
4380
|
},
|
|
4381
|
+
{
|
|
4382
|
+
key: "createScte35CueContext",
|
|
4383
|
+
value: function createScte35CueContext(source, readiness, frag) {
|
|
4384
|
+
var context = {
|
|
4385
|
+
source: source,
|
|
4386
|
+
readiness: readiness
|
|
4387
|
+
};
|
|
4388
|
+
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
4389
|
+
context.fragmentSn = frag.sn;
|
|
4390
|
+
}
|
|
4391
|
+
var fragmentStartSeconds = this.getFragmentStartSeconds(frag);
|
|
4392
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4393
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4394
|
+
}
|
|
4395
|
+
return context;
|
|
4396
|
+
}
|
|
4397
|
+
},
|
|
4398
|
+
{
|
|
4399
|
+
key: "getFragmentStartSeconds",
|
|
4400
|
+
value: function getFragmentStartSeconds(frag) {
|
|
4401
|
+
var candidates = [
|
|
4402
|
+
frag === null || frag === void 0 ? void 0 : frag.start,
|
|
4403
|
+
frag === null || frag === void 0 ? void 0 : frag.startPTS
|
|
4404
|
+
];
|
|
4405
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4406
|
+
try {
|
|
4407
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4408
|
+
var candidate = _step.value;
|
|
4409
|
+
if (typeof candidate === "number" && Number.isFinite(candidate)) {
|
|
4410
|
+
return candidate;
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
} catch (err) {
|
|
4414
|
+
_didIteratorError = true;
|
|
4415
|
+
_iteratorError = err;
|
|
4416
|
+
} finally{
|
|
4417
|
+
try {
|
|
4418
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4419
|
+
_iterator.return();
|
|
4420
|
+
}
|
|
4421
|
+
} finally{
|
|
4422
|
+
if (_didIteratorError) {
|
|
4423
|
+
throw _iteratorError;
|
|
4424
|
+
}
|
|
4425
|
+
}
|
|
4426
|
+
}
|
|
4427
|
+
return void 0;
|
|
4428
|
+
}
|
|
4429
|
+
},
|
|
4430
|
+
{
|
|
4431
|
+
key: "onScte35Cue",
|
|
4432
|
+
value: function onScte35Cue(marker, context) {
|
|
4433
|
+
var cue = this.createScte35Cue(marker, context);
|
|
4434
|
+
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
4435
|
+
if (context.readiness === "early") {
|
|
4436
|
+
this.pendingScte35Cues.set(pendingKey, cue);
|
|
4437
|
+
this.trimRecentScte35CueMaps();
|
|
4438
|
+
if (marker.type === "start") {
|
|
4439
|
+
this.startAdPrefetch(marker, context.fragmentSn, cue.key);
|
|
4440
|
+
}
|
|
4441
|
+
return;
|
|
4442
|
+
}
|
|
4443
|
+
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
4444
|
+
if (this.config.debugAdTiming) {
|
|
4445
|
+
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
4446
|
+
key: cue.key,
|
|
4447
|
+
activeScte35BreakKey: this.activeScte35BreakKey,
|
|
4448
|
+
inAdBreak: this.inAdBreak,
|
|
4449
|
+
source: cue.source
|
|
4450
|
+
});
|
|
4451
|
+
}
|
|
4452
|
+
return;
|
|
4453
|
+
}
|
|
4454
|
+
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
4455
|
+
if (this.config.debugAdTiming) {
|
|
4456
|
+
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
4457
|
+
key: cue.key,
|
|
4458
|
+
source: cue.source
|
|
4459
|
+
});
|
|
4460
|
+
}
|
|
4461
|
+
return;
|
|
4462
|
+
}
|
|
4463
|
+
this.pendingScte35Cues.delete(pendingKey);
|
|
4464
|
+
this.markScte35CueHandled(cue);
|
|
4465
|
+
this.onScte35Marker(marker, cue.key);
|
|
4466
|
+
}
|
|
4467
|
+
},
|
|
4468
|
+
{
|
|
4469
|
+
key: "createScte35Cue",
|
|
4470
|
+
value: function createScte35Cue(marker, context) {
|
|
4471
|
+
var cue = {
|
|
4472
|
+
marker: marker,
|
|
4473
|
+
source: context.source,
|
|
4474
|
+
readiness: context.readiness,
|
|
4475
|
+
key: this.getScte35CueKey(marker, context)
|
|
4476
|
+
};
|
|
4477
|
+
if (context.fragmentSn !== void 0) {
|
|
4478
|
+
cue.fragmentSn = context.fragmentSn;
|
|
4479
|
+
}
|
|
4480
|
+
if (context.fragmentStartSeconds !== void 0) {
|
|
4481
|
+
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
4482
|
+
}
|
|
4483
|
+
return cue;
|
|
4484
|
+
}
|
|
4485
|
+
},
|
|
4486
|
+
{
|
|
4487
|
+
key: "getScte35CueKey",
|
|
4488
|
+
value: function getScte35CueKey(marker, context) {
|
|
4489
|
+
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
4490
|
+
var raw = this.getScte35MarkerRaw(marker);
|
|
4491
|
+
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
4492
|
+
if (spliceEventId) {
|
|
4493
|
+
return "splice:".concat(spliceEventId);
|
|
4494
|
+
}
|
|
4495
|
+
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
4496
|
+
if (segmentationEventId) {
|
|
4497
|
+
return "segmentation:".concat(segmentationEventId);
|
|
4498
|
+
}
|
|
4499
|
+
var daterangeId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs = raw.attrs) === null || _raw_attrs === void 0 ? void 0 : _raw_attrs.ID);
|
|
4500
|
+
if (daterangeId) {
|
|
4501
|
+
return "daterange:".concat(daterangeId);
|
|
4502
|
+
}
|
|
4503
|
+
var scteValue = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs1 = raw.attrs) === null || _raw_attrs1 === void 0 ? void 0 : _raw_attrs1["SCTE35-OUT"]) || this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs2 = raw.attrs) === null || _raw_attrs2 === void 0 ? void 0 : _raw_attrs2["SCTE35-IN"]);
|
|
4504
|
+
if (scteValue) {
|
|
4505
|
+
return "daterange-scte:".concat(scteValue);
|
|
4506
|
+
}
|
|
4507
|
+
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
4508
|
+
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
4509
|
+
}
|
|
4510
|
+
if (context.fragmentSn !== void 0) {
|
|
4511
|
+
return "fragment:".concat(context.fragmentSn);
|
|
4512
|
+
}
|
|
4513
|
+
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4514
|
+
}
|
|
4515
|
+
},
|
|
4516
|
+
{
|
|
4517
|
+
key: "getPendingScte35CueKey",
|
|
4518
|
+
value: function getPendingScte35CueKey(cue) {
|
|
4519
|
+
return "".concat(cue.marker.type, ":").concat(cue.key, ":").concat(cue.fragmentSn !== void 0 ? cue.fragmentSn : "unknown");
|
|
4520
|
+
}
|
|
4521
|
+
},
|
|
4522
|
+
{
|
|
4523
|
+
key: "getScte35MarkerRaw",
|
|
4524
|
+
value: function getScte35MarkerRaw(marker) {
|
|
4525
|
+
return _type_of(marker.raw) === "object" && marker.raw !== null ? marker.raw : {};
|
|
4526
|
+
}
|
|
4527
|
+
},
|
|
4528
|
+
{
|
|
4529
|
+
key: "toIdentityString",
|
|
4530
|
+
value: function toIdentityString(value) {
|
|
4531
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4532
|
+
return String(value);
|
|
4533
|
+
}
|
|
4534
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
4535
|
+
return value.trim();
|
|
4536
|
+
}
|
|
4537
|
+
return void 0;
|
|
4538
|
+
}
|
|
4539
|
+
},
|
|
4540
|
+
{
|
|
4541
|
+
key: "isStrongScte35CueKey",
|
|
4542
|
+
value: function isStrongScte35CueKey(key) {
|
|
4543
|
+
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4544
|
+
}
|
|
4545
|
+
},
|
|
4546
|
+
{
|
|
4547
|
+
key: "hasRecentlyHandledScte35Cue",
|
|
4548
|
+
value: function hasRecentlyHandledScte35Cue(cue) {
|
|
4549
|
+
if (this.activeScte35BreakKey === cue.key || this.scheduledScte35BreakKey === cue.key) {
|
|
4550
|
+
return true;
|
|
4551
|
+
}
|
|
4552
|
+
var recentKey = "".concat(cue.marker.type, ":").concat(cue.key);
|
|
4553
|
+
return this.recentScte35CueKeys.has(recentKey);
|
|
4554
|
+
}
|
|
4555
|
+
},
|
|
4556
|
+
{
|
|
4557
|
+
key: "markScte35CueHandled",
|
|
4558
|
+
value: function markScte35CueHandled(cue) {
|
|
4559
|
+
this.recentScte35CueKeys.set("".concat(cue.marker.type, ":").concat(cue.key), Date.now());
|
|
4560
|
+
this.trimRecentScte35CueMaps();
|
|
4561
|
+
}
|
|
4562
|
+
},
|
|
4563
|
+
{
|
|
4564
|
+
key: "trimRecentScte35CueMaps",
|
|
4565
|
+
value: function trimRecentScte35CueMaps() {
|
|
4566
|
+
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
4567
|
+
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
4568
|
+
if (!firstKey) {
|
|
4569
|
+
break;
|
|
4570
|
+
}
|
|
4571
|
+
this.recentScte35CueKeys.delete(firstKey);
|
|
4572
|
+
}
|
|
4573
|
+
while(this.pendingScte35Cues.size > this.recentScte35CueLimit){
|
|
4574
|
+
var firstKey1 = this.pendingScte35Cues.keys().next().value;
|
|
4575
|
+
if (!firstKey1) {
|
|
4576
|
+
break;
|
|
4577
|
+
}
|
|
4578
|
+
this.pendingScte35Cues.delete(firstKey1);
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
},
|
|
4582
|
+
{
|
|
4583
|
+
key: "shouldAcceptScte35EndCue",
|
|
4584
|
+
value: function shouldAcceptScte35EndCue(cue) {
|
|
4585
|
+
if (!this.inAdBreak) {
|
|
4586
|
+
return false;
|
|
4587
|
+
}
|
|
4588
|
+
if (this.isStrongScte35CueKey(this.activeScte35BreakKey) && this.isStrongScte35CueKey(cue.key) && this.activeScte35BreakKey !== cue.key) {
|
|
4589
|
+
return false;
|
|
4590
|
+
}
|
|
4591
|
+
return true;
|
|
4592
|
+
}
|
|
4593
|
+
},
|
|
4594
|
+
{
|
|
4595
|
+
key: "activatePendingScte35CuesForFragment",
|
|
4596
|
+
value: function activatePendingScte35CuesForFragment(frag) {
|
|
4597
|
+
var _this = this;
|
|
4598
|
+
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
4599
|
+
if (fragmentSn === void 0) {
|
|
4600
|
+
return;
|
|
4601
|
+
}
|
|
4602
|
+
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
4603
|
+
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
4604
|
+
return cue.fragmentSn === fragmentSn;
|
|
4605
|
+
});
|
|
4606
|
+
matchingCues.forEach(function(param) {
|
|
4607
|
+
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
4608
|
+
var _cue_fragmentStartSeconds;
|
|
4609
|
+
_this.pendingScte35Cues.delete(pendingKey);
|
|
4610
|
+
var context = {
|
|
4611
|
+
source: cue.source,
|
|
4612
|
+
readiness: "playback"
|
|
4613
|
+
};
|
|
4614
|
+
context.fragmentSn = fragmentSn;
|
|
4615
|
+
var fragmentStartSeconds = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : _this.getFragmentStartSeconds(frag);
|
|
4616
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4617
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4618
|
+
}
|
|
4619
|
+
_this.onScte35Cue(cue.marker, context);
|
|
4620
|
+
});
|
|
4621
|
+
}
|
|
4622
|
+
},
|
|
4360
4623
|
{
|
|
4361
4624
|
key: "onScte35Marker",
|
|
4362
|
-
value: function onScte35Marker(marker) {
|
|
4625
|
+
value: function onScte35Marker(marker, cueKey) {
|
|
4363
4626
|
if (this.config.debugAdTiming) {
|
|
4364
4627
|
console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
|
|
4365
4628
|
type: marker.type,
|
|
@@ -4373,13 +4636,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4373
4636
|
if (marker.type === "start") {
|
|
4374
4637
|
var _this_config_immediateManifestAds;
|
|
4375
4638
|
var _this_pendingAdBreak;
|
|
4376
|
-
if (!this.video.muted) {
|
|
4377
|
-
this.video.muted = true;
|
|
4378
|
-
this.video.volume = 0;
|
|
4379
|
-
if (this.config.debugAdTiming) {
|
|
4380
|
-
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4381
|
-
}
|
|
4382
|
-
}
|
|
4383
4639
|
if (this.inAdBreak) {
|
|
4384
4640
|
if (marker.durationSeconds != null) {
|
|
4385
4641
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
@@ -4403,10 +4659,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4403
4659
|
sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
|
|
4404
4660
|
}
|
|
4405
4661
|
var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
|
|
4406
|
-
this.inAdBreak = true;
|
|
4407
4662
|
var durationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : ((_this_pendingAdBreak = this.pendingAdBreak) === null || _this_pendingAdBreak === void 0 ? void 0 : _this_pendingAdBreak.marker.durationSeconds) != null ? this.pendingAdBreak.marker.durationSeconds * 1e3 : void 0;
|
|
4408
|
-
this.expectedAdBreakDurationMs = durationMs;
|
|
4409
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4410
4663
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
4411
4664
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
4412
4665
|
if (this.config.debugAdTiming) {
|
|
@@ -4422,7 +4675,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4422
4675
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (manifest-based)".concat(hasPrefetchedAds ? " with prefetched ads" : ""));
|
|
4423
4676
|
}
|
|
4424
4677
|
this.clearAdStartTimer();
|
|
4425
|
-
this.
|
|
4678
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4426
4679
|
} else if (typeof marker.ptsSeconds === "number") {
|
|
4427
4680
|
var _this_config_driftToleranceMs;
|
|
4428
4681
|
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
@@ -4442,23 +4695,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4442
4695
|
if (this.config.debugAdTiming) {
|
|
4443
4696
|
console.log("[StormcloudVideoPlayer] Scheduling ad start in ".concat(deltaMs, "ms"));
|
|
4444
4697
|
}
|
|
4445
|
-
this.
|
|
4698
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4699
|
+
this.scheduledScte35BreakKey = cueKey;
|
|
4700
|
+
this.scheduleAdStartIn(deltaMs, marker, cueKey);
|
|
4446
4701
|
} else {
|
|
4447
4702
|
if (this.config.debugAdTiming) {
|
|
4448
4703
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (within tolerance)");
|
|
4449
4704
|
}
|
|
4450
4705
|
this.clearAdStartTimer();
|
|
4451
|
-
this.
|
|
4706
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4452
4707
|
}
|
|
4453
4708
|
} else {
|
|
4454
4709
|
if (this.config.debugAdTiming) {
|
|
4455
4710
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (fallback)");
|
|
4456
4711
|
}
|
|
4457
4712
|
this.clearAdStartTimer();
|
|
4458
|
-
this.
|
|
4459
|
-
}
|
|
4460
|
-
if (this.expectedAdBreakDurationMs != null) {
|
|
4461
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4713
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4462
4714
|
}
|
|
4463
4715
|
return;
|
|
4464
4716
|
}
|
|
@@ -4514,6 +4766,27 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4514
4766
|
}
|
|
4515
4767
|
}
|
|
4516
4768
|
},
|
|
4769
|
+
{
|
|
4770
|
+
key: "startScte35AdBreak",
|
|
4771
|
+
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4772
|
+
if (!this.video.muted) {
|
|
4773
|
+
this.video.muted = true;
|
|
4774
|
+
this.video.volume = 0;
|
|
4775
|
+
if (this.config.debugAdTiming) {
|
|
4776
|
+
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
this.inAdBreak = true;
|
|
4780
|
+
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4781
|
+
this.scheduledScte35BreakKey = void 0;
|
|
4782
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4783
|
+
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4784
|
+
this.handleAdStart(marker);
|
|
4785
|
+
if (this.expectedAdBreakDurationMs != null) {
|
|
4786
|
+
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4787
|
+
}
|
|
4788
|
+
}
|
|
4789
|
+
},
|
|
4517
4790
|
{
|
|
4518
4791
|
key: "parseCueOutDuration",
|
|
4519
4792
|
value: function parseCueOutDuration(value) {
|
|
@@ -4597,6 +4870,336 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4597
4870
|
return false;
|
|
4598
4871
|
}
|
|
4599
4872
|
},
|
|
4873
|
+
{
|
|
4874
|
+
key: "normalizeFragmentPayload",
|
|
4875
|
+
value: function normalizeFragmentPayload(payload) {
|
|
4876
|
+
if (_instanceof(payload, Uint8Array)) {
|
|
4877
|
+
return payload;
|
|
4878
|
+
}
|
|
4879
|
+
if (_instanceof(payload, ArrayBuffer)) {
|
|
4880
|
+
return new Uint8Array(payload);
|
|
4881
|
+
}
|
|
4882
|
+
if (ArrayBuffer.isView(payload)) {
|
|
4883
|
+
var view = payload;
|
|
4884
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
4885
|
+
}
|
|
4886
|
+
return void 0;
|
|
4887
|
+
}
|
|
4888
|
+
},
|
|
4889
|
+
{
|
|
4890
|
+
key: "processFragmentScte35Payload",
|
|
4891
|
+
value: function processFragmentScte35Payload(payloadData, fragmentSn, fragmentStartSeconds) {
|
|
4892
|
+
var _this = this;
|
|
4893
|
+
var payload = this.normalizeFragmentPayload(payloadData);
|
|
4894
|
+
if (!payload) {
|
|
4895
|
+
return;
|
|
4896
|
+
}
|
|
4897
|
+
var markers = this.parseScte35FromTsPackets(payload);
|
|
4898
|
+
markers.forEach(function(marker) {
|
|
4899
|
+
var context = {
|
|
4900
|
+
source: "ts",
|
|
4901
|
+
readiness: "early"
|
|
4902
|
+
};
|
|
4903
|
+
if (fragmentSn !== void 0) {
|
|
4904
|
+
context.fragmentSn = fragmentSn;
|
|
4905
|
+
}
|
|
4906
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4907
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4908
|
+
}
|
|
4909
|
+
_this.onScte35Cue(marker, context);
|
|
4910
|
+
});
|
|
4911
|
+
}
|
|
4912
|
+
},
|
|
4913
|
+
{
|
|
4914
|
+
key: "parseScte35FromTsPackets",
|
|
4915
|
+
value: function parseScte35FromTsPackets(data) {
|
|
4916
|
+
var packetInfo = this.detectTsPacketFormat(data);
|
|
4917
|
+
if (!packetInfo) {
|
|
4918
|
+
return [];
|
|
4919
|
+
}
|
|
4920
|
+
var markers = [];
|
|
4921
|
+
var sectionAssemblers = /* @__PURE__ */ new Map();
|
|
4922
|
+
for(var packetStart = packetInfo.offset; packetStart + packetInfo.packetSize <= data.length; packetStart += packetInfo.packetSize){
|
|
4923
|
+
var tsStart = packetStart + packetInfo.tsPayloadOffset;
|
|
4924
|
+
if (data[tsStart] !== 71) {
|
|
4925
|
+
continue;
|
|
4926
|
+
}
|
|
4927
|
+
var secondByte = data[tsStart + 1];
|
|
4928
|
+
var thirdByte = data[tsStart + 2];
|
|
4929
|
+
var fourthByte = data[tsStart + 3];
|
|
4930
|
+
if (secondByte == null || thirdByte == null || fourthByte == null || (secondByte & 128) !== 0) {
|
|
4931
|
+
continue;
|
|
4932
|
+
}
|
|
4933
|
+
var payloadUnitStart = (secondByte & 64) !== 0;
|
|
4934
|
+
var pid = (secondByte & 31) << 8 | thirdByte;
|
|
4935
|
+
var adaptationFieldControl = fourthByte >> 4 & 3;
|
|
4936
|
+
var hasPayload = adaptationFieldControl === 1 || adaptationFieldControl === 3;
|
|
4937
|
+
if (!hasPayload) {
|
|
4938
|
+
continue;
|
|
4939
|
+
}
|
|
4940
|
+
var payloadStart = tsStart + 4;
|
|
4941
|
+
if (adaptationFieldControl === 3) {
|
|
4942
|
+
var adaptationLength = data[payloadStart];
|
|
4943
|
+
if (adaptationLength == null) {
|
|
4944
|
+
continue;
|
|
4945
|
+
}
|
|
4946
|
+
payloadStart += 1 + adaptationLength;
|
|
4947
|
+
}
|
|
4948
|
+
var payloadEnd = Math.min(tsStart + 188, data.length);
|
|
4949
|
+
if (payloadStart >= payloadEnd || payloadStart >= data.length) {
|
|
4950
|
+
continue;
|
|
4951
|
+
}
|
|
4952
|
+
var payload = data.subarray(payloadStart, payloadEnd);
|
|
4953
|
+
if (pid === 0) {
|
|
4954
|
+
this.parsePatSection(payload, payloadUnitStart);
|
|
4955
|
+
} else if (this.pmtPids.has(pid)) {
|
|
4956
|
+
this.parsePmtSection(payload, payloadUnitStart);
|
|
4957
|
+
} else if (this.tsScte35Pids.has(pid)) {
|
|
4958
|
+
this.collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, sectionAssemblers, markers);
|
|
4959
|
+
}
|
|
4960
|
+
}
|
|
4961
|
+
return markers;
|
|
4962
|
+
}
|
|
4963
|
+
},
|
|
4964
|
+
{
|
|
4965
|
+
key: "detectTsPacketFormat",
|
|
4966
|
+
value: function detectTsPacketFormat(data) {
|
|
4967
|
+
var packetSizes = [
|
|
4968
|
+
188,
|
|
4969
|
+
192,
|
|
4970
|
+
204
|
|
4971
|
+
];
|
|
4972
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4973
|
+
try {
|
|
4974
|
+
for(var _iterator = packetSizes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4975
|
+
var packetSize = _step.value;
|
|
4976
|
+
var tsPayloadOffset = packetSize === 192 ? 4 : 0;
|
|
4977
|
+
for(var offset = 0; offset < packetSize; offset++){
|
|
4978
|
+
var matchedPackets = 0;
|
|
4979
|
+
for(var packetStart = offset; packetStart + tsPayloadOffset < data.length && matchedPackets < 5; packetStart += packetSize){
|
|
4980
|
+
if (data[packetStart + tsPayloadOffset] !== 71) {
|
|
4981
|
+
break;
|
|
4982
|
+
}
|
|
4983
|
+
matchedPackets++;
|
|
4984
|
+
}
|
|
4985
|
+
if (matchedPackets >= 2) {
|
|
4986
|
+
return {
|
|
4987
|
+
offset: offset,
|
|
4988
|
+
packetSize: packetSize,
|
|
4989
|
+
tsPayloadOffset: tsPayloadOffset
|
|
4990
|
+
};
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
4994
|
+
} catch (err) {
|
|
4995
|
+
_didIteratorError = true;
|
|
4996
|
+
_iteratorError = err;
|
|
4997
|
+
} finally{
|
|
4998
|
+
try {
|
|
4999
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5000
|
+
_iterator.return();
|
|
5001
|
+
}
|
|
5002
|
+
} finally{
|
|
5003
|
+
if (_didIteratorError) {
|
|
5004
|
+
throw _iteratorError;
|
|
5005
|
+
}
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5008
|
+
return void 0;
|
|
5009
|
+
}
|
|
5010
|
+
},
|
|
5011
|
+
{
|
|
5012
|
+
key: "parsePatSection",
|
|
5013
|
+
value: function parsePatSection(payload, payloadUnitStart) {
|
|
5014
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
5015
|
+
if (sectionStart == null || sectionStart + 8 >= payload.length) {
|
|
5016
|
+
return;
|
|
5017
|
+
}
|
|
5018
|
+
if (payload[sectionStart] !== 0) {
|
|
5019
|
+
return;
|
|
5020
|
+
}
|
|
5021
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
5022
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
5023
|
+
for(var offset = sectionStart + 8; offset + 4 <= sectionEnd - 4; offset += 4){
|
|
5024
|
+
var _payload_offset, _payload_, _payload_1, _payload_2;
|
|
5025
|
+
var programNumber = ((_payload_offset = payload[offset]) !== null && _payload_offset !== void 0 ? _payload_offset : 0) << 8 | ((_payload_ = payload[offset + 1]) !== null && _payload_ !== void 0 ? _payload_ : 0);
|
|
5026
|
+
var pid = (((_payload_1 = payload[offset + 2]) !== null && _payload_1 !== void 0 ? _payload_1 : 0) & 31) << 8 | ((_payload_2 = payload[offset + 3]) !== null && _payload_2 !== void 0 ? _payload_2 : 0);
|
|
5027
|
+
if (programNumber !== 0) {
|
|
5028
|
+
this.pmtPids.add(pid);
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
}
|
|
5032
|
+
},
|
|
5033
|
+
{
|
|
5034
|
+
key: "parsePmtSection",
|
|
5035
|
+
value: function parsePmtSection(payload, payloadUnitStart) {
|
|
5036
|
+
var _payload_, _payload_1;
|
|
5037
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
5038
|
+
if (sectionStart == null || sectionStart + 12 >= payload.length) {
|
|
5039
|
+
return;
|
|
5040
|
+
}
|
|
5041
|
+
if (payload[sectionStart] !== 2) {
|
|
5042
|
+
return;
|
|
5043
|
+
}
|
|
5044
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
5045
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
5046
|
+
var programInfoLength = (((_payload_ = payload[sectionStart + 10]) !== null && _payload_ !== void 0 ? _payload_ : 0) & 15) << 8 | ((_payload_1 = payload[sectionStart + 11]) !== null && _payload_1 !== void 0 ? _payload_1 : 0);
|
|
5047
|
+
var offset = sectionStart + 12 + programInfoLength;
|
|
5048
|
+
while(offset + 5 <= sectionEnd - 4){
|
|
5049
|
+
var _payload_offset, _payload_2, _payload_3, _payload_4, _payload_5;
|
|
5050
|
+
var streamType = (_payload_offset = payload[offset]) !== null && _payload_offset !== void 0 ? _payload_offset : 0;
|
|
5051
|
+
var elementaryPid = (((_payload_2 = payload[offset + 1]) !== null && _payload_2 !== void 0 ? _payload_2 : 0) & 31) << 8 | ((_payload_3 = payload[offset + 2]) !== null && _payload_3 !== void 0 ? _payload_3 : 0);
|
|
5052
|
+
var esInfoLength = (((_payload_4 = payload[offset + 3]) !== null && _payload_4 !== void 0 ? _payload_4 : 0) & 15) << 8 | ((_payload_5 = payload[offset + 4]) !== null && _payload_5 !== void 0 ? _payload_5 : 0);
|
|
5053
|
+
var descriptorStart = offset + 5;
|
|
5054
|
+
var descriptorEnd = Math.min(descriptorStart + esInfoLength, sectionEnd - 4);
|
|
5055
|
+
if (streamType === 134 || streamType === 6 && this.descriptorsIdentifyScte35(payload, descriptorStart, descriptorEnd)) {
|
|
5056
|
+
this.tsScte35Pids.add(elementaryPid);
|
|
5057
|
+
}
|
|
5058
|
+
offset = descriptorStart + esInfoLength;
|
|
5059
|
+
}
|
|
5060
|
+
}
|
|
5061
|
+
},
|
|
5062
|
+
{
|
|
5063
|
+
key: "descriptorsIdentifyScte35",
|
|
5064
|
+
value: function descriptorsIdentifyScte35(data, start, end) {
|
|
5065
|
+
var offset = start;
|
|
5066
|
+
while(offset + 2 <= end){
|
|
5067
|
+
var _data_offset, _data_, _data_descriptorStart, _data_1, _data_2, _data_3;
|
|
5068
|
+
var tag = (_data_offset = data[offset]) !== null && _data_offset !== void 0 ? _data_offset : 0;
|
|
5069
|
+
var length = (_data_ = data[offset + 1]) !== null && _data_ !== void 0 ? _data_ : 0;
|
|
5070
|
+
var descriptorStart = offset + 2;
|
|
5071
|
+
var descriptorEnd = descriptorStart + length;
|
|
5072
|
+
if (descriptorEnd > end) {
|
|
5073
|
+
return false;
|
|
5074
|
+
}
|
|
5075
|
+
var registration = length >= 4 ? String.fromCharCode((_data_descriptorStart = data[descriptorStart]) !== null && _data_descriptorStart !== void 0 ? _data_descriptorStart : 0, (_data_1 = data[descriptorStart + 1]) !== null && _data_1 !== void 0 ? _data_1 : 0, (_data_2 = data[descriptorStart + 2]) !== null && _data_2 !== void 0 ? _data_2 : 0, (_data_3 = data[descriptorStart + 3]) !== null && _data_3 !== void 0 ? _data_3 : 0) : "";
|
|
5076
|
+
if (tag === 138 || registration === "CUEI" || registration === "SCTE") {
|
|
5077
|
+
return true;
|
|
5078
|
+
}
|
|
5079
|
+
offset = descriptorEnd;
|
|
5080
|
+
}
|
|
5081
|
+
return false;
|
|
5082
|
+
}
|
|
5083
|
+
},
|
|
5084
|
+
{
|
|
5085
|
+
key: "collectScte35SectionsFromPayload",
|
|
5086
|
+
value: function collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, assemblers, markers) {
|
|
5087
|
+
if (payload.length === 0) {
|
|
5088
|
+
return;
|
|
5089
|
+
}
|
|
5090
|
+
var offset = 0;
|
|
5091
|
+
if (payloadUnitStart) {
|
|
5092
|
+
var _payload_;
|
|
5093
|
+
var pointerField = (_payload_ = payload[0]) !== null && _payload_ !== void 0 ? _payload_ : 0;
|
|
5094
|
+
var previousAssembler = assemblers.get(pid);
|
|
5095
|
+
if (previousAssembler && pointerField > 0) {
|
|
5096
|
+
this.appendScte35Bytes(pid, payload.subarray(1, Math.min(1 + pointerField, payload.length)), assemblers, markers);
|
|
5097
|
+
}
|
|
5098
|
+
assemblers.delete(pid);
|
|
5099
|
+
offset = 1 + pointerField;
|
|
5100
|
+
} else {
|
|
5101
|
+
this.appendScte35Bytes(pid, payload, assemblers, markers);
|
|
5102
|
+
return;
|
|
5103
|
+
}
|
|
5104
|
+
while(offset + 3 <= payload.length){
|
|
5105
|
+
var tableId = payload[offset];
|
|
5106
|
+
if (tableId == null || tableId === 255) {
|
|
5107
|
+
return;
|
|
5108
|
+
}
|
|
5109
|
+
var sectionLength = this.getPsiSectionLength(payload, offset);
|
|
5110
|
+
var totalLength = 3 + sectionLength;
|
|
5111
|
+
if (sectionLength <= 0 || totalLength <= 3) {
|
|
5112
|
+
return;
|
|
5113
|
+
}
|
|
5114
|
+
if (offset + totalLength <= payload.length) {
|
|
5115
|
+
this.addScte35SectionMarker(payload.subarray(offset, offset + totalLength), markers);
|
|
5116
|
+
offset += totalLength;
|
|
5117
|
+
} else {
|
|
5118
|
+
assemblers.set(pid, {
|
|
5119
|
+
bytes: Array.from(payload.subarray(offset)),
|
|
5120
|
+
expectedLength: totalLength
|
|
5121
|
+
});
|
|
5122
|
+
return;
|
|
5123
|
+
}
|
|
5124
|
+
}
|
|
5125
|
+
}
|
|
5126
|
+
},
|
|
5127
|
+
{
|
|
5128
|
+
key: "appendScte35Bytes",
|
|
5129
|
+
value: function appendScte35Bytes(pid, bytes, assemblers, markers) {
|
|
5130
|
+
var assembler = assemblers.get(pid);
|
|
5131
|
+
if (!assembler) {
|
|
5132
|
+
return;
|
|
5133
|
+
}
|
|
5134
|
+
for(var i = 0; i < bytes.length && assembler.bytes.length < assembler.expectedLength; i++){
|
|
5135
|
+
var _bytes_i;
|
|
5136
|
+
assembler.bytes.push((_bytes_i = bytes[i]) !== null && _bytes_i !== void 0 ? _bytes_i : 0);
|
|
5137
|
+
}
|
|
5138
|
+
if (assembler.bytes.length >= assembler.expectedLength) {
|
|
5139
|
+
assemblers.delete(pid);
|
|
5140
|
+
this.addScte35SectionMarker(new Uint8Array(assembler.bytes), markers);
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
},
|
|
5144
|
+
{
|
|
5145
|
+
key: "addScte35SectionMarker",
|
|
5146
|
+
value: function addScte35SectionMarker(section, markers) {
|
|
5147
|
+
if (section[0] !== 252 || this.hasProcessedTsScte35Section(section)) {
|
|
5148
|
+
return;
|
|
5149
|
+
}
|
|
5150
|
+
var marker = this.parseScte35Binary(section);
|
|
5151
|
+
if (!marker) {
|
|
5152
|
+
return;
|
|
5153
|
+
}
|
|
5154
|
+
marker.raw = _object_spread_props(_object_spread({}, _type_of(marker.raw) === "object" && marker.raw ? marker.raw : {}), {
|
|
5155
|
+
source: "ts-packet"
|
|
5156
|
+
});
|
|
5157
|
+
markers.push(marker);
|
|
5158
|
+
}
|
|
5159
|
+
},
|
|
5160
|
+
{
|
|
5161
|
+
key: "hasProcessedTsScte35Section",
|
|
5162
|
+
value: function hasProcessedTsScte35Section(section) {
|
|
5163
|
+
var checksum = 0;
|
|
5164
|
+
for(var i = 0; i < section.length; i++){
|
|
5165
|
+
var _section_i;
|
|
5166
|
+
checksum = checksum * 31 + ((_section_i = section[i]) !== null && _section_i !== void 0 ? _section_i : 0) >>> 0;
|
|
5167
|
+
}
|
|
5168
|
+
var key = "".concat(section.length, ":").concat(checksum);
|
|
5169
|
+
if (this.processedTsScte35Sections.has(key)) {
|
|
5170
|
+
return true;
|
|
5171
|
+
}
|
|
5172
|
+
this.processedTsScte35Sections.add(key);
|
|
5173
|
+
if (this.processedTsScte35Sections.size > 200) {
|
|
5174
|
+
var firstKey = this.processedTsScte35Sections.values().next().value;
|
|
5175
|
+
if (firstKey) {
|
|
5176
|
+
this.processedTsScte35Sections.delete(firstKey);
|
|
5177
|
+
}
|
|
5178
|
+
}
|
|
5179
|
+
return false;
|
|
5180
|
+
}
|
|
5181
|
+
},
|
|
5182
|
+
{
|
|
5183
|
+
key: "getPsiSectionStart",
|
|
5184
|
+
value: function getPsiSectionStart(payload, payloadUnitStart) {
|
|
5185
|
+
if (!payloadUnitStart) {
|
|
5186
|
+
return void 0;
|
|
5187
|
+
}
|
|
5188
|
+
var pointerField = payload[0];
|
|
5189
|
+
if (pointerField == null) {
|
|
5190
|
+
return void 0;
|
|
5191
|
+
}
|
|
5192
|
+
var sectionStart = 1 + pointerField;
|
|
5193
|
+
return sectionStart < payload.length ? sectionStart : void 0;
|
|
5194
|
+
}
|
|
5195
|
+
},
|
|
5196
|
+
{
|
|
5197
|
+
key: "getPsiSectionLength",
|
|
5198
|
+
value: function getPsiSectionLength(data, offset) {
|
|
5199
|
+
var _data_, _data_1;
|
|
5200
|
+
return (((_data_ = data[offset + 1]) !== null && _data_ !== void 0 ? _data_ : 0) & 15) << 8 | ((_data_1 = data[offset + 2]) !== null && _data_1 !== void 0 ? _data_1 : 0);
|
|
5201
|
+
}
|
|
5202
|
+
},
|
|
4600
5203
|
{
|
|
4601
5204
|
key: "parseScte35Binary",
|
|
4602
5205
|
value: function parseScte35Binary(data) {
|
|
@@ -4636,10 +5239,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4636
5239
|
value: function skipBits(n) {
|
|
4637
5240
|
this.readBits(n);
|
|
4638
5241
|
}
|
|
5242
|
+
},
|
|
5243
|
+
{
|
|
5244
|
+
key: "bytePosition",
|
|
5245
|
+
get: function get() {
|
|
5246
|
+
return this.bitPos === 0 ? this.bytePos : this.bytePos + 1;
|
|
5247
|
+
}
|
|
4639
5248
|
}
|
|
4640
5249
|
]);
|
|
4641
5250
|
return BitReader;
|
|
4642
5251
|
}();
|
|
5252
|
+
var readSpliceTime = function readSpliceTime(r2, ptsAdjustmentTicks2) {
|
|
5253
|
+
var timeSpecifiedFlag = r2.readBits(1) === 1;
|
|
5254
|
+
if (!timeSpecifiedFlag) {
|
|
5255
|
+
r2.readBits(7);
|
|
5256
|
+
return void 0;
|
|
5257
|
+
}
|
|
5258
|
+
r2.readBits(6);
|
|
5259
|
+
var high = r2.readBits(1);
|
|
5260
|
+
var low = r2.readBits(32);
|
|
5261
|
+
var ptsTicks = (high * 4294967296 + low + ptsAdjustmentTicks2) % 8589934592;
|
|
5262
|
+
return ptsTicks / 9e4;
|
|
5263
|
+
};
|
|
4643
5264
|
var r = new BitReader(data);
|
|
4644
5265
|
var tableId = r.readBits(8);
|
|
4645
5266
|
if (tableId !== 252) return void 0;
|
|
@@ -4647,77 +5268,206 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4647
5268
|
r.readBits(1);
|
|
4648
5269
|
r.readBits(2);
|
|
4649
5270
|
var sectionLength = r.readBits(12);
|
|
5271
|
+
if (sectionLength <= 0 || data.length < 3 + sectionLength) {
|
|
5272
|
+
return void 0;
|
|
5273
|
+
}
|
|
4650
5274
|
r.readBits(8);
|
|
4651
5275
|
r.readBits(1);
|
|
4652
5276
|
r.readBits(6);
|
|
4653
5277
|
var ptsAdjHigh = r.readBits(1);
|
|
4654
5278
|
var ptsAdjLow = r.readBits(32);
|
|
4655
|
-
|
|
4656
|
-
void ptsAdjLow;
|
|
5279
|
+
var ptsAdjustmentTicks = ptsAdjHigh * 4294967296 + ptsAdjLow;
|
|
4657
5280
|
r.readBits(8);
|
|
4658
5281
|
r.readBits(12);
|
|
4659
5282
|
var spliceCommandLength = r.readBits(12);
|
|
4660
5283
|
var spliceCommandType = r.readBits(8);
|
|
4661
|
-
|
|
5284
|
+
var markerType;
|
|
5285
|
+
var durationSeconds = void 0;
|
|
5286
|
+
var ptsSeconds = void 0;
|
|
5287
|
+
var spliceEventId = void 0;
|
|
5288
|
+
var commandBodyStart = r.bytePosition;
|
|
5289
|
+
if (spliceCommandType === 5) {
|
|
5290
|
+
spliceEventId = r.readBits(32);
|
|
5291
|
+
var cancel = r.readBits(1) === 1;
|
|
5292
|
+
r.readBits(7);
|
|
5293
|
+
if (cancel) return void 0;
|
|
5294
|
+
var outOfNetwork = r.readBits(1) === 1;
|
|
5295
|
+
var programSpliceFlag = r.readBits(1) === 1;
|
|
5296
|
+
var durationFlag = r.readBits(1) === 1;
|
|
5297
|
+
var spliceImmediateFlag = r.readBits(1) === 1;
|
|
5298
|
+
r.readBits(4);
|
|
5299
|
+
markerType = outOfNetwork ? "start" : "end";
|
|
5300
|
+
if (programSpliceFlag && !spliceImmediateFlag) {
|
|
5301
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5302
|
+
} else if (!programSpliceFlag) {
|
|
5303
|
+
var componentCount = r.readBits(8);
|
|
5304
|
+
for(var i = 0; i < componentCount; i++){
|
|
5305
|
+
r.readBits(8);
|
|
5306
|
+
if (!spliceImmediateFlag) {
|
|
5307
|
+
var componentPtsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5308
|
+
if (ptsSeconds === void 0) {
|
|
5309
|
+
ptsSeconds = componentPtsSeconds;
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
if (durationFlag) {
|
|
5315
|
+
r.readBits(6);
|
|
5316
|
+
r.readBits(1);
|
|
5317
|
+
var high = r.readBits(1);
|
|
5318
|
+
var low = r.readBits(32);
|
|
5319
|
+
var durationTicks = high * 4294967296 + low;
|
|
5320
|
+
durationSeconds = durationTicks / 9e4;
|
|
5321
|
+
}
|
|
5322
|
+
r.readBits(16);
|
|
5323
|
+
r.readBits(8);
|
|
5324
|
+
r.readBits(8);
|
|
5325
|
+
} else if (spliceCommandType === 6) {
|
|
5326
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5327
|
+
} else {
|
|
4662
5328
|
return void 0;
|
|
4663
5329
|
}
|
|
4664
|
-
r.
|
|
4665
|
-
var
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
}
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
5330
|
+
var expectedDescriptorOffset = spliceCommandLength === 4095 ? r.bytePosition : commandBodyStart + spliceCommandLength;
|
|
5331
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptors(data, expectedDescriptorOffset);
|
|
5332
|
+
if (descriptorMarker) {
|
|
5333
|
+
markerType = descriptorMarker.type;
|
|
5334
|
+
if (durationSeconds === void 0) {
|
|
5335
|
+
durationSeconds = descriptorMarker.durationSeconds;
|
|
5336
|
+
}
|
|
5337
|
+
}
|
|
5338
|
+
if (!markerType) {
|
|
5339
|
+
return void 0;
|
|
5340
|
+
}
|
|
5341
|
+
var marker = _object_spread_props(_object_spread({
|
|
5342
|
+
type: markerType
|
|
5343
|
+
}, ptsSeconds !== void 0 ? {
|
|
5344
|
+
ptsSeconds: ptsSeconds
|
|
5345
|
+
} : {}, durationSeconds !== void 0 ? {
|
|
5346
|
+
durationSeconds: durationSeconds
|
|
5347
|
+
} : {}), {
|
|
5348
|
+
raw: _object_spread({
|
|
5349
|
+
splice_command_type: spliceCommandType
|
|
5350
|
+
}, spliceEventId !== void 0 ? {
|
|
5351
|
+
splice_event_id: spliceEventId
|
|
5352
|
+
} : {}, (descriptorMarker === null || descriptorMarker === void 0 ? void 0 : descriptorMarker.segmentationEventId) !== void 0 ? {
|
|
5353
|
+
segmentation_event_id: descriptorMarker.segmentationEventId
|
|
5354
|
+
} : {})
|
|
5355
|
+
});
|
|
5356
|
+
return marker;
|
|
5357
|
+
}
|
|
5358
|
+
},
|
|
5359
|
+
{
|
|
5360
|
+
key: "parseScte35SegmentationDescriptors",
|
|
5361
|
+
value: function parseScte35SegmentationDescriptors(data, offset) {
|
|
5362
|
+
var _data_offset, _data_;
|
|
5363
|
+
if (offset + 2 > data.length) {
|
|
5364
|
+
return void 0;
|
|
5365
|
+
}
|
|
5366
|
+
var descriptorLoopLength = ((_data_offset = data[offset]) !== null && _data_offset !== void 0 ? _data_offset : 0) << 8 | ((_data_ = data[offset + 1]) !== null && _data_ !== void 0 ? _data_ : 0);
|
|
5367
|
+
var descriptorOffset = offset + 2;
|
|
5368
|
+
var descriptorEnd = Math.min(data.length, descriptorOffset + descriptorLoopLength);
|
|
5369
|
+
while(descriptorOffset + 2 <= descriptorEnd){
|
|
5370
|
+
var _data_descriptorOffset, _data_1;
|
|
5371
|
+
var descriptorTag = (_data_descriptorOffset = data[descriptorOffset]) !== null && _data_descriptorOffset !== void 0 ? _data_descriptorOffset : 0;
|
|
5372
|
+
var descriptorLength = (_data_1 = data[descriptorOffset + 1]) !== null && _data_1 !== void 0 ? _data_1 : 0;
|
|
5373
|
+
var descriptorDataStart = descriptorOffset + 2;
|
|
5374
|
+
var descriptorDataEnd = descriptorDataStart + descriptorLength;
|
|
5375
|
+
if (descriptorDataEnd > descriptorEnd) {
|
|
5376
|
+
return void 0;
|
|
5377
|
+
}
|
|
5378
|
+
if (descriptorTag === 2) {
|
|
5379
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptor(data.subarray(descriptorDataStart, descriptorDataEnd));
|
|
5380
|
+
if (descriptorMarker) {
|
|
5381
|
+
return descriptorMarker;
|
|
4693
5382
|
}
|
|
4694
5383
|
}
|
|
5384
|
+
descriptorOffset = descriptorDataEnd;
|
|
5385
|
+
}
|
|
5386
|
+
return void 0;
|
|
5387
|
+
}
|
|
5388
|
+
},
|
|
5389
|
+
{
|
|
5390
|
+
key: "parseScte35SegmentationDescriptor",
|
|
5391
|
+
value: function parseScte35SegmentationDescriptor(descriptor) {
|
|
5392
|
+
var _descriptor_, _descriptor_1, _descriptor_2, _descriptor_3, _descriptor_4, _descriptor_5, _descriptor_6, _descriptor_7, _descriptor_8, _descriptor_9, _descriptor_offset, _descriptor_offset1;
|
|
5393
|
+
if (descriptor.length < 11) {
|
|
5394
|
+
return void 0;
|
|
5395
|
+
}
|
|
5396
|
+
var identifier = String.fromCharCode((_descriptor_ = descriptor[0]) !== null && _descriptor_ !== void 0 ? _descriptor_ : 0, (_descriptor_1 = descriptor[1]) !== null && _descriptor_1 !== void 0 ? _descriptor_1 : 0, (_descriptor_2 = descriptor[2]) !== null && _descriptor_2 !== void 0 ? _descriptor_2 : 0, (_descriptor_3 = descriptor[3]) !== null && _descriptor_3 !== void 0 ? _descriptor_3 : 0);
|
|
5397
|
+
if (identifier !== "CUEI") {
|
|
5398
|
+
return void 0;
|
|
5399
|
+
}
|
|
5400
|
+
var segmentationEventId = ((_descriptor_4 = descriptor[4]) !== null && _descriptor_4 !== void 0 ? _descriptor_4 : 0) * 16777216 + (((_descriptor_5 = descriptor[5]) !== null && _descriptor_5 !== void 0 ? _descriptor_5 : 0) << 16) + (((_descriptor_6 = descriptor[6]) !== null && _descriptor_6 !== void 0 ? _descriptor_6 : 0) << 8) + ((_descriptor_7 = descriptor[7]) !== null && _descriptor_7 !== void 0 ? _descriptor_7 : 0);
|
|
5401
|
+
var cancelIndicator = (((_descriptor_8 = descriptor[8]) !== null && _descriptor_8 !== void 0 ? _descriptor_8 : 0) & 128) !== 0;
|
|
5402
|
+
if (cancelIndicator) {
|
|
5403
|
+
return void 0;
|
|
5404
|
+
}
|
|
5405
|
+
var flags = (_descriptor_9 = descriptor[9]) !== null && _descriptor_9 !== void 0 ? _descriptor_9 : 0;
|
|
5406
|
+
var programSegmentationFlag = (flags & 128) !== 0;
|
|
5407
|
+
var segmentationDurationFlag = (flags & 64) !== 0;
|
|
5408
|
+
var offset = 10;
|
|
5409
|
+
if (!programSegmentationFlag) {
|
|
5410
|
+
var _descriptor_offset2;
|
|
5411
|
+
var componentCount = (_descriptor_offset2 = descriptor[offset]) !== null && _descriptor_offset2 !== void 0 ? _descriptor_offset2 : 0;
|
|
5412
|
+
offset += 1 + componentCount * 6;
|
|
5413
|
+
if (offset > descriptor.length) {
|
|
5414
|
+
return void 0;
|
|
5415
|
+
}
|
|
4695
5416
|
}
|
|
4696
5417
|
var durationSeconds = void 0;
|
|
4697
|
-
if (
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
var durationTicks =
|
|
5418
|
+
if (segmentationDurationFlag) {
|
|
5419
|
+
var _descriptor_offset3, _descriptor_10, _descriptor_11, _descriptor_12, _descriptor_13;
|
|
5420
|
+
if (offset + 5 > descriptor.length) {
|
|
5421
|
+
return void 0;
|
|
5422
|
+
}
|
|
5423
|
+
var durationTicks = ((_descriptor_offset3 = descriptor[offset]) !== null && _descriptor_offset3 !== void 0 ? _descriptor_offset3 : 0) * 4294967296 + ((_descriptor_10 = descriptor[offset + 1]) !== null && _descriptor_10 !== void 0 ? _descriptor_10 : 0) * 16777216 + (((_descriptor_11 = descriptor[offset + 2]) !== null && _descriptor_11 !== void 0 ? _descriptor_11 : 0) << 16) + (((_descriptor_12 = descriptor[offset + 3]) !== null && _descriptor_12 !== void 0 ? _descriptor_12 : 0) << 8) + ((_descriptor_13 = descriptor[offset + 4]) !== null && _descriptor_13 !== void 0 ? _descriptor_13 : 0);
|
|
4703
5424
|
durationSeconds = durationTicks / 9e4;
|
|
5425
|
+
offset += 5;
|
|
4704
5426
|
}
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
5427
|
+
if (offset + 2 > descriptor.length) {
|
|
5428
|
+
return void 0;
|
|
5429
|
+
}
|
|
5430
|
+
offset += 1;
|
|
5431
|
+
var segmentationUpidLength = (_descriptor_offset = descriptor[offset]) !== null && _descriptor_offset !== void 0 ? _descriptor_offset : 0;
|
|
5432
|
+
offset += 1 + segmentationUpidLength;
|
|
5433
|
+
if (offset >= descriptor.length) {
|
|
5434
|
+
return void 0;
|
|
5435
|
+
}
|
|
5436
|
+
var segmentationTypeId = (_descriptor_offset1 = descriptor[offset]) !== null && _descriptor_offset1 !== void 0 ? _descriptor_offset1 : 0;
|
|
5437
|
+
var markerType = this.markerTypeFromSegmentationTypeId(segmentationTypeId);
|
|
5438
|
+
if (!markerType) {
|
|
5439
|
+
return void 0;
|
|
5440
|
+
}
|
|
5441
|
+
return _object_spread_props(_object_spread({
|
|
5442
|
+
type: markerType
|
|
5443
|
+
}, durationSeconds !== void 0 ? {
|
|
5444
|
+
durationSeconds: durationSeconds
|
|
5445
|
+
} : {}), {
|
|
5446
|
+
segmentationEventId: segmentationEventId
|
|
5447
|
+
});
|
|
5448
|
+
}
|
|
5449
|
+
},
|
|
5450
|
+
{
|
|
5451
|
+
key: "markerTypeFromSegmentationTypeId",
|
|
5452
|
+
value: function markerTypeFromSegmentationTypeId(segmentationTypeId) {
|
|
5453
|
+
switch(segmentationTypeId){
|
|
5454
|
+
case 16:
|
|
5455
|
+
case 34:
|
|
5456
|
+
case 48:
|
|
5457
|
+
case 50:
|
|
5458
|
+
case 52:
|
|
5459
|
+
case 54:
|
|
5460
|
+
return "start";
|
|
5461
|
+
case 17:
|
|
5462
|
+
case 35:
|
|
5463
|
+
case 49:
|
|
5464
|
+
case 51:
|
|
5465
|
+
case 53:
|
|
5466
|
+
case 55:
|
|
5467
|
+
return "end";
|
|
5468
|
+
default:
|
|
5469
|
+
return void 0;
|
|
4719
5470
|
}
|
|
4720
|
-
return void 0;
|
|
4721
5471
|
}
|
|
4722
5472
|
},
|
|
4723
5473
|
{
|
|
@@ -5114,7 +5864,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5114
5864
|
},
|
|
5115
5865
|
{
|
|
5116
5866
|
key: "startAdPrefetch",
|
|
5117
|
-
value: function startAdPrefetch(marker, fragmentSn) {
|
|
5867
|
+
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
5118
5868
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
5119
5869
|
return;
|
|
5120
5870
|
}
|
|
@@ -5142,6 +5892,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5142
5892
|
isFetching: false,
|
|
5143
5893
|
fetchStartTime: Date.now()
|
|
5144
5894
|
});
|
|
5895
|
+
this.pendingScte35CueKey = cueKey;
|
|
5145
5896
|
this.adDetectSentForCurrentBreak = true;
|
|
5146
5897
|
var detectPayload = {};
|
|
5147
5898
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
@@ -5163,6 +5914,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5163
5914
|
this.prefetchTimerId = void 0;
|
|
5164
5915
|
}
|
|
5165
5916
|
this.pendingAdBreak = null;
|
|
5917
|
+
this.pendingScte35CueKey = void 0;
|
|
5166
5918
|
}
|
|
5167
5919
|
},
|
|
5168
5920
|
{
|
|
@@ -6646,18 +7398,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6646
7398
|
key: "scheduleAdStartIn",
|
|
6647
7399
|
value: function scheduleAdStartIn(delayMs) {
|
|
6648
7400
|
var _this = this;
|
|
7401
|
+
var marker = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7402
|
+
type: "start"
|
|
7403
|
+
}, cueKey = arguments.length > 2 ? arguments[2] : void 0;
|
|
6649
7404
|
this.clearAdStartTimer();
|
|
6650
7405
|
var ms = Math.max(0, Math.floor(delayMs));
|
|
6651
7406
|
if (ms === 0) {
|
|
6652
|
-
this.
|
|
6653
|
-
type: "start"
|
|
6654
|
-
}).catch(function() {});
|
|
7407
|
+
this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0);
|
|
6655
7408
|
return;
|
|
6656
7409
|
}
|
|
6657
7410
|
this.adStartTimerId = window.setTimeout(function() {
|
|
6658
|
-
_this.
|
|
6659
|
-
type: "start"
|
|
6660
|
-
}).catch(function() {});
|
|
7411
|
+
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.expectedAdBreakDurationMs);
|
|
6661
7412
|
}, ms);
|
|
6662
7413
|
}
|
|
6663
7414
|
},
|
|
@@ -7088,6 +7839,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7088
7839
|
this.adRequestQueue = [];
|
|
7089
7840
|
this.inAdBreak = false;
|
|
7090
7841
|
this.adDetectSentForCurrentBreak = false;
|
|
7842
|
+
this.activeScte35BreakKey = void 0;
|
|
7843
|
+
this.scheduledScte35BreakKey = void 0;
|
|
7091
7844
|
this.expectedAdBreakDurationMs = void 0;
|
|
7092
7845
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
7093
7846
|
this.clearAdStartTimer();
|