stormcloud-video-player 0.3.57 → 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/README.md +243 -10
- 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/players/index.cjs
CHANGED
|
@@ -3312,6 +3312,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3312
3312
|
this.adRequestQueue = [];
|
|
3313
3313
|
this.maxPlaceholderDurationMs = 5e3;
|
|
3314
3314
|
this.isShowingPlaceholder = false;
|
|
3315
|
+
this.tsScte35Pids = /* @__PURE__ */ new Set();
|
|
3316
|
+
this.pmtPids = /* @__PURE__ */ new Set();
|
|
3317
|
+
this.processedTsScte35Sections = /* @__PURE__ */ new Set();
|
|
3318
|
+
this.pendingScte35Cues = /* @__PURE__ */ new Map();
|
|
3319
|
+
this.recentScte35CueKeys = /* @__PURE__ */ new Map();
|
|
3320
|
+
this.recentScte35CueLimit = 200;
|
|
3315
3321
|
this.totalAdRequestsInBreak = 0;
|
|
3316
3322
|
this.maxTotalAdRequestsPerBreak = 10;
|
|
3317
3323
|
this.pendingAdBreak = null;
|
|
@@ -3581,7 +3587,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3581
3587
|
if (_this.config.debugAdTiming) {
|
|
3582
3588
|
console.log("[StormcloudVideoPlayer] \uD83C\uDFAF EARLY SCTE-35 DETECTION: Ad break marker found in fragment", i, "- starting pre-fetch (NOT playing yet)");
|
|
3583
3589
|
}
|
|
3584
|
-
_this.
|
|
3590
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "early", frag)));
|
|
3585
3591
|
return;
|
|
3586
3592
|
}
|
|
3587
3593
|
}
|
|
@@ -3662,10 +3668,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3662
3668
|
return _this.onId3Tag(tag);
|
|
3663
3669
|
});
|
|
3664
3670
|
});
|
|
3671
|
+
this.hls.on(import_hls2.default.Events.FRAG_LOADED, function(_evt, data) {
|
|
3672
|
+
var _data_frag;
|
|
3673
|
+
_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));
|
|
3674
|
+
});
|
|
3675
|
+
this.hls.on(import_hls2.default.Events.FRAG_DECRYPTED, function(_evt, data) {
|
|
3676
|
+
var _data_frag;
|
|
3677
|
+
_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));
|
|
3678
|
+
});
|
|
3665
3679
|
this.hls.on(import_hls2.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3666
3680
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3667
3681
|
var tagList = frag === null || frag === void 0 ? void 0 : frag.tagList;
|
|
3668
|
-
if (!Array.isArray(tagList))
|
|
3682
|
+
if (!Array.isArray(tagList)) {
|
|
3683
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3684
|
+
return;
|
|
3685
|
+
}
|
|
3669
3686
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3670
3687
|
try {
|
|
3671
3688
|
for(var _iterator = tagList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -3701,7 +3718,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3701
3718
|
value: value
|
|
3702
3719
|
}
|
|
3703
3720
|
});
|
|
3704
|
-
_this.
|
|
3721
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3705
3722
|
} else if (tag.includes("EXT-X-CUE-OUT")) {
|
|
3706
3723
|
var durationSeconds = _this.parseCueOutDuration(value);
|
|
3707
3724
|
var marker1 = _object_spread_props(_object_spread({
|
|
@@ -3714,15 +3731,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3714
3731
|
value: value
|
|
3715
3732
|
}
|
|
3716
3733
|
});
|
|
3717
|
-
_this.
|
|
3734
|
+
_this.onScte35Cue(marker1, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3718
3735
|
} else if (tag.includes("EXT-X-CUE-IN")) {
|
|
3719
|
-
_this.
|
|
3736
|
+
_this.onScte35Cue({
|
|
3720
3737
|
type: "end",
|
|
3721
3738
|
raw: {
|
|
3722
3739
|
tag: tag,
|
|
3723
3740
|
value: value
|
|
3724
3741
|
}
|
|
3725
|
-
});
|
|
3742
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3726
3743
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
3727
3744
|
var _attrs_CLASS;
|
|
3728
3745
|
var attrs = _this.parseAttributeList(value);
|
|
@@ -3742,17 +3759,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3742
3759
|
attrs: attrs
|
|
3743
3760
|
}
|
|
3744
3761
|
});
|
|
3745
|
-
_this.
|
|
3762
|
+
_this.onScte35Cue(marker2, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3746
3763
|
}
|
|
3747
3764
|
if (hasScteIn) {
|
|
3748
|
-
_this.
|
|
3765
|
+
_this.onScte35Cue({
|
|
3749
3766
|
type: "end",
|
|
3750
3767
|
raw: {
|
|
3751
3768
|
tag: tag,
|
|
3752
3769
|
value: value,
|
|
3753
3770
|
attrs: attrs
|
|
3754
3771
|
}
|
|
3755
|
-
});
|
|
3772
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3756
3773
|
}
|
|
3757
3774
|
}
|
|
3758
3775
|
}
|
|
@@ -3770,6 +3787,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3770
3787
|
}
|
|
3771
3788
|
}
|
|
3772
3789
|
}
|
|
3790
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3773
3791
|
});
|
|
3774
3792
|
this.hls.on(import_hls2.default.Events.ERROR, function(_evt, data) {
|
|
3775
3793
|
if (data === null || data === void 0 ? void 0 : data.fatal) {
|
|
@@ -4075,7 +4093,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4075
4093
|
}
|
|
4076
4094
|
var marker = this.parseScte35FromId3(tag);
|
|
4077
4095
|
if (marker) {
|
|
4078
|
-
this.
|
|
4096
|
+
this.onScte35Cue(marker, {
|
|
4097
|
+
source: "id3",
|
|
4098
|
+
readiness: "playback"
|
|
4099
|
+
});
|
|
4079
4100
|
}
|
|
4080
4101
|
}
|
|
4081
4102
|
},
|
|
@@ -4219,9 +4240,251 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4219
4240
|
}
|
|
4220
4241
|
}
|
|
4221
4242
|
},
|
|
4243
|
+
{
|
|
4244
|
+
key: "createScte35CueContext",
|
|
4245
|
+
value: function createScte35CueContext(source, readiness, frag) {
|
|
4246
|
+
var context = {
|
|
4247
|
+
source: source,
|
|
4248
|
+
readiness: readiness
|
|
4249
|
+
};
|
|
4250
|
+
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
4251
|
+
context.fragmentSn = frag.sn;
|
|
4252
|
+
}
|
|
4253
|
+
var fragmentStartSeconds = this.getFragmentStartSeconds(frag);
|
|
4254
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4255
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4256
|
+
}
|
|
4257
|
+
return context;
|
|
4258
|
+
}
|
|
4259
|
+
},
|
|
4260
|
+
{
|
|
4261
|
+
key: "getFragmentStartSeconds",
|
|
4262
|
+
value: function getFragmentStartSeconds(frag) {
|
|
4263
|
+
var candidates = [
|
|
4264
|
+
frag === null || frag === void 0 ? void 0 : frag.start,
|
|
4265
|
+
frag === null || frag === void 0 ? void 0 : frag.startPTS
|
|
4266
|
+
];
|
|
4267
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4268
|
+
try {
|
|
4269
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4270
|
+
var candidate = _step.value;
|
|
4271
|
+
if (typeof candidate === "number" && Number.isFinite(candidate)) {
|
|
4272
|
+
return candidate;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
} catch (err) {
|
|
4276
|
+
_didIteratorError = true;
|
|
4277
|
+
_iteratorError = err;
|
|
4278
|
+
} finally{
|
|
4279
|
+
try {
|
|
4280
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4281
|
+
_iterator.return();
|
|
4282
|
+
}
|
|
4283
|
+
} finally{
|
|
4284
|
+
if (_didIteratorError) {
|
|
4285
|
+
throw _iteratorError;
|
|
4286
|
+
}
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
return void 0;
|
|
4290
|
+
}
|
|
4291
|
+
},
|
|
4292
|
+
{
|
|
4293
|
+
key: "onScte35Cue",
|
|
4294
|
+
value: function onScte35Cue(marker, context) {
|
|
4295
|
+
var cue = this.createScte35Cue(marker, context);
|
|
4296
|
+
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
4297
|
+
if (context.readiness === "early") {
|
|
4298
|
+
this.pendingScte35Cues.set(pendingKey, cue);
|
|
4299
|
+
this.trimRecentScte35CueMaps();
|
|
4300
|
+
if (marker.type === "start") {
|
|
4301
|
+
this.startAdPrefetch(marker, context.fragmentSn, cue.key);
|
|
4302
|
+
}
|
|
4303
|
+
return;
|
|
4304
|
+
}
|
|
4305
|
+
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
4306
|
+
if (this.config.debugAdTiming) {
|
|
4307
|
+
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
4308
|
+
key: cue.key,
|
|
4309
|
+
activeScte35BreakKey: this.activeScte35BreakKey,
|
|
4310
|
+
inAdBreak: this.inAdBreak,
|
|
4311
|
+
source: cue.source
|
|
4312
|
+
});
|
|
4313
|
+
}
|
|
4314
|
+
return;
|
|
4315
|
+
}
|
|
4316
|
+
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
4317
|
+
if (this.config.debugAdTiming) {
|
|
4318
|
+
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
4319
|
+
key: cue.key,
|
|
4320
|
+
source: cue.source
|
|
4321
|
+
});
|
|
4322
|
+
}
|
|
4323
|
+
return;
|
|
4324
|
+
}
|
|
4325
|
+
this.pendingScte35Cues.delete(pendingKey);
|
|
4326
|
+
this.markScte35CueHandled(cue);
|
|
4327
|
+
this.onScte35Marker(marker, cue.key);
|
|
4328
|
+
}
|
|
4329
|
+
},
|
|
4330
|
+
{
|
|
4331
|
+
key: "createScte35Cue",
|
|
4332
|
+
value: function createScte35Cue(marker, context) {
|
|
4333
|
+
var cue = {
|
|
4334
|
+
marker: marker,
|
|
4335
|
+
source: context.source,
|
|
4336
|
+
readiness: context.readiness,
|
|
4337
|
+
key: this.getScte35CueKey(marker, context)
|
|
4338
|
+
};
|
|
4339
|
+
if (context.fragmentSn !== void 0) {
|
|
4340
|
+
cue.fragmentSn = context.fragmentSn;
|
|
4341
|
+
}
|
|
4342
|
+
if (context.fragmentStartSeconds !== void 0) {
|
|
4343
|
+
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
4344
|
+
}
|
|
4345
|
+
return cue;
|
|
4346
|
+
}
|
|
4347
|
+
},
|
|
4348
|
+
{
|
|
4349
|
+
key: "getScte35CueKey",
|
|
4350
|
+
value: function getScte35CueKey(marker, context) {
|
|
4351
|
+
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
4352
|
+
var raw = this.getScte35MarkerRaw(marker);
|
|
4353
|
+
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
4354
|
+
if (spliceEventId) {
|
|
4355
|
+
return "splice:".concat(spliceEventId);
|
|
4356
|
+
}
|
|
4357
|
+
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
4358
|
+
if (segmentationEventId) {
|
|
4359
|
+
return "segmentation:".concat(segmentationEventId);
|
|
4360
|
+
}
|
|
4361
|
+
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);
|
|
4362
|
+
if (daterangeId) {
|
|
4363
|
+
return "daterange:".concat(daterangeId);
|
|
4364
|
+
}
|
|
4365
|
+
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"]);
|
|
4366
|
+
if (scteValue) {
|
|
4367
|
+
return "daterange-scte:".concat(scteValue);
|
|
4368
|
+
}
|
|
4369
|
+
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
4370
|
+
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
4371
|
+
}
|
|
4372
|
+
if (context.fragmentSn !== void 0) {
|
|
4373
|
+
return "fragment:".concat(context.fragmentSn);
|
|
4374
|
+
}
|
|
4375
|
+
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4376
|
+
}
|
|
4377
|
+
},
|
|
4378
|
+
{
|
|
4379
|
+
key: "getPendingScte35CueKey",
|
|
4380
|
+
value: function getPendingScte35CueKey(cue) {
|
|
4381
|
+
return "".concat(cue.marker.type, ":").concat(cue.key, ":").concat(cue.fragmentSn !== void 0 ? cue.fragmentSn : "unknown");
|
|
4382
|
+
}
|
|
4383
|
+
},
|
|
4384
|
+
{
|
|
4385
|
+
key: "getScte35MarkerRaw",
|
|
4386
|
+
value: function getScte35MarkerRaw(marker) {
|
|
4387
|
+
return _type_of(marker.raw) === "object" && marker.raw !== null ? marker.raw : {};
|
|
4388
|
+
}
|
|
4389
|
+
},
|
|
4390
|
+
{
|
|
4391
|
+
key: "toIdentityString",
|
|
4392
|
+
value: function toIdentityString(value) {
|
|
4393
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4394
|
+
return String(value);
|
|
4395
|
+
}
|
|
4396
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
4397
|
+
return value.trim();
|
|
4398
|
+
}
|
|
4399
|
+
return void 0;
|
|
4400
|
+
}
|
|
4401
|
+
},
|
|
4402
|
+
{
|
|
4403
|
+
key: "isStrongScte35CueKey",
|
|
4404
|
+
value: function isStrongScte35CueKey(key) {
|
|
4405
|
+
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4406
|
+
}
|
|
4407
|
+
},
|
|
4408
|
+
{
|
|
4409
|
+
key: "hasRecentlyHandledScte35Cue",
|
|
4410
|
+
value: function hasRecentlyHandledScte35Cue(cue) {
|
|
4411
|
+
if (this.activeScte35BreakKey === cue.key || this.scheduledScte35BreakKey === cue.key) {
|
|
4412
|
+
return true;
|
|
4413
|
+
}
|
|
4414
|
+
var recentKey = "".concat(cue.marker.type, ":").concat(cue.key);
|
|
4415
|
+
return this.recentScte35CueKeys.has(recentKey);
|
|
4416
|
+
}
|
|
4417
|
+
},
|
|
4418
|
+
{
|
|
4419
|
+
key: "markScte35CueHandled",
|
|
4420
|
+
value: function markScte35CueHandled(cue) {
|
|
4421
|
+
this.recentScte35CueKeys.set("".concat(cue.marker.type, ":").concat(cue.key), Date.now());
|
|
4422
|
+
this.trimRecentScte35CueMaps();
|
|
4423
|
+
}
|
|
4424
|
+
},
|
|
4425
|
+
{
|
|
4426
|
+
key: "trimRecentScte35CueMaps",
|
|
4427
|
+
value: function trimRecentScte35CueMaps() {
|
|
4428
|
+
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
4429
|
+
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
4430
|
+
if (!firstKey) {
|
|
4431
|
+
break;
|
|
4432
|
+
}
|
|
4433
|
+
this.recentScte35CueKeys.delete(firstKey);
|
|
4434
|
+
}
|
|
4435
|
+
while(this.pendingScte35Cues.size > this.recentScte35CueLimit){
|
|
4436
|
+
var firstKey1 = this.pendingScte35Cues.keys().next().value;
|
|
4437
|
+
if (!firstKey1) {
|
|
4438
|
+
break;
|
|
4439
|
+
}
|
|
4440
|
+
this.pendingScte35Cues.delete(firstKey1);
|
|
4441
|
+
}
|
|
4442
|
+
}
|
|
4443
|
+
},
|
|
4444
|
+
{
|
|
4445
|
+
key: "shouldAcceptScte35EndCue",
|
|
4446
|
+
value: function shouldAcceptScte35EndCue(cue) {
|
|
4447
|
+
if (!this.inAdBreak) {
|
|
4448
|
+
return false;
|
|
4449
|
+
}
|
|
4450
|
+
if (this.isStrongScte35CueKey(this.activeScte35BreakKey) && this.isStrongScte35CueKey(cue.key) && this.activeScte35BreakKey !== cue.key) {
|
|
4451
|
+
return false;
|
|
4452
|
+
}
|
|
4453
|
+
return true;
|
|
4454
|
+
}
|
|
4455
|
+
},
|
|
4456
|
+
{
|
|
4457
|
+
key: "activatePendingScte35CuesForFragment",
|
|
4458
|
+
value: function activatePendingScte35CuesForFragment(frag) {
|
|
4459
|
+
var _this = this;
|
|
4460
|
+
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
4461
|
+
if (fragmentSn === void 0) {
|
|
4462
|
+
return;
|
|
4463
|
+
}
|
|
4464
|
+
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
4465
|
+
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
4466
|
+
return cue.fragmentSn === fragmentSn;
|
|
4467
|
+
});
|
|
4468
|
+
matchingCues.forEach(function(param) {
|
|
4469
|
+
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
4470
|
+
var _cue_fragmentStartSeconds;
|
|
4471
|
+
_this.pendingScte35Cues.delete(pendingKey);
|
|
4472
|
+
var context = {
|
|
4473
|
+
source: cue.source,
|
|
4474
|
+
readiness: "playback"
|
|
4475
|
+
};
|
|
4476
|
+
context.fragmentSn = fragmentSn;
|
|
4477
|
+
var fragmentStartSeconds = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : _this.getFragmentStartSeconds(frag);
|
|
4478
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4479
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4480
|
+
}
|
|
4481
|
+
_this.onScte35Cue(cue.marker, context);
|
|
4482
|
+
});
|
|
4483
|
+
}
|
|
4484
|
+
},
|
|
4222
4485
|
{
|
|
4223
4486
|
key: "onScte35Marker",
|
|
4224
|
-
value: function onScte35Marker(marker) {
|
|
4487
|
+
value: function onScte35Marker(marker, cueKey) {
|
|
4225
4488
|
if (this.config.debugAdTiming) {
|
|
4226
4489
|
console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
|
|
4227
4490
|
type: marker.type,
|
|
@@ -4235,13 +4498,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4235
4498
|
if (marker.type === "start") {
|
|
4236
4499
|
var _this_config_immediateManifestAds;
|
|
4237
4500
|
var _this_pendingAdBreak;
|
|
4238
|
-
if (!this.video.muted) {
|
|
4239
|
-
this.video.muted = true;
|
|
4240
|
-
this.video.volume = 0;
|
|
4241
|
-
if (this.config.debugAdTiming) {
|
|
4242
|
-
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4243
|
-
}
|
|
4244
|
-
}
|
|
4245
4501
|
if (this.inAdBreak) {
|
|
4246
4502
|
if (marker.durationSeconds != null) {
|
|
4247
4503
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
@@ -4265,10 +4521,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4265
4521
|
sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
|
|
4266
4522
|
}
|
|
4267
4523
|
var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
|
|
4268
|
-
this.inAdBreak = true;
|
|
4269
4524
|
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;
|
|
4270
|
-
this.expectedAdBreakDurationMs = durationMs;
|
|
4271
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4272
4525
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
4273
4526
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
4274
4527
|
if (this.config.debugAdTiming) {
|
|
@@ -4284,7 +4537,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4284
4537
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (manifest-based)".concat(hasPrefetchedAds ? " with prefetched ads" : ""));
|
|
4285
4538
|
}
|
|
4286
4539
|
this.clearAdStartTimer();
|
|
4287
|
-
this.
|
|
4540
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4288
4541
|
} else if (typeof marker.ptsSeconds === "number") {
|
|
4289
4542
|
var _this_config_driftToleranceMs;
|
|
4290
4543
|
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
@@ -4304,23 +4557,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4304
4557
|
if (this.config.debugAdTiming) {
|
|
4305
4558
|
console.log("[StormcloudVideoPlayer] Scheduling ad start in ".concat(deltaMs, "ms"));
|
|
4306
4559
|
}
|
|
4307
|
-
this.
|
|
4560
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4561
|
+
this.scheduledScte35BreakKey = cueKey;
|
|
4562
|
+
this.scheduleAdStartIn(deltaMs, marker, cueKey);
|
|
4308
4563
|
} else {
|
|
4309
4564
|
if (this.config.debugAdTiming) {
|
|
4310
4565
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (within tolerance)");
|
|
4311
4566
|
}
|
|
4312
4567
|
this.clearAdStartTimer();
|
|
4313
|
-
this.
|
|
4568
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4314
4569
|
}
|
|
4315
4570
|
} else {
|
|
4316
4571
|
if (this.config.debugAdTiming) {
|
|
4317
4572
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (fallback)");
|
|
4318
4573
|
}
|
|
4319
4574
|
this.clearAdStartTimer();
|
|
4320
|
-
this.
|
|
4321
|
-
}
|
|
4322
|
-
if (this.expectedAdBreakDurationMs != null) {
|
|
4323
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4575
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4324
4576
|
}
|
|
4325
4577
|
return;
|
|
4326
4578
|
}
|
|
@@ -4376,6 +4628,27 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4376
4628
|
}
|
|
4377
4629
|
}
|
|
4378
4630
|
},
|
|
4631
|
+
{
|
|
4632
|
+
key: "startScte35AdBreak",
|
|
4633
|
+
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4634
|
+
if (!this.video.muted) {
|
|
4635
|
+
this.video.muted = true;
|
|
4636
|
+
this.video.volume = 0;
|
|
4637
|
+
if (this.config.debugAdTiming) {
|
|
4638
|
+
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
this.inAdBreak = true;
|
|
4642
|
+
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4643
|
+
this.scheduledScte35BreakKey = void 0;
|
|
4644
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4645
|
+
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4646
|
+
this.handleAdStart(marker);
|
|
4647
|
+
if (this.expectedAdBreakDurationMs != null) {
|
|
4648
|
+
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
},
|
|
4379
4652
|
{
|
|
4380
4653
|
key: "parseCueOutDuration",
|
|
4381
4654
|
value: function parseCueOutDuration(value) {
|
|
@@ -4459,6 +4732,336 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4459
4732
|
return false;
|
|
4460
4733
|
}
|
|
4461
4734
|
},
|
|
4735
|
+
{
|
|
4736
|
+
key: "normalizeFragmentPayload",
|
|
4737
|
+
value: function normalizeFragmentPayload(payload) {
|
|
4738
|
+
if (_instanceof(payload, Uint8Array)) {
|
|
4739
|
+
return payload;
|
|
4740
|
+
}
|
|
4741
|
+
if (_instanceof(payload, ArrayBuffer)) {
|
|
4742
|
+
return new Uint8Array(payload);
|
|
4743
|
+
}
|
|
4744
|
+
if (ArrayBuffer.isView(payload)) {
|
|
4745
|
+
var view = payload;
|
|
4746
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
4747
|
+
}
|
|
4748
|
+
return void 0;
|
|
4749
|
+
}
|
|
4750
|
+
},
|
|
4751
|
+
{
|
|
4752
|
+
key: "processFragmentScte35Payload",
|
|
4753
|
+
value: function processFragmentScte35Payload(payloadData, fragmentSn, fragmentStartSeconds) {
|
|
4754
|
+
var _this = this;
|
|
4755
|
+
var payload = this.normalizeFragmentPayload(payloadData);
|
|
4756
|
+
if (!payload) {
|
|
4757
|
+
return;
|
|
4758
|
+
}
|
|
4759
|
+
var markers = this.parseScte35FromTsPackets(payload);
|
|
4760
|
+
markers.forEach(function(marker) {
|
|
4761
|
+
var context = {
|
|
4762
|
+
source: "ts",
|
|
4763
|
+
readiness: "early"
|
|
4764
|
+
};
|
|
4765
|
+
if (fragmentSn !== void 0) {
|
|
4766
|
+
context.fragmentSn = fragmentSn;
|
|
4767
|
+
}
|
|
4768
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4769
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4770
|
+
}
|
|
4771
|
+
_this.onScte35Cue(marker, context);
|
|
4772
|
+
});
|
|
4773
|
+
}
|
|
4774
|
+
},
|
|
4775
|
+
{
|
|
4776
|
+
key: "parseScte35FromTsPackets",
|
|
4777
|
+
value: function parseScte35FromTsPackets(data) {
|
|
4778
|
+
var packetInfo = this.detectTsPacketFormat(data);
|
|
4779
|
+
if (!packetInfo) {
|
|
4780
|
+
return [];
|
|
4781
|
+
}
|
|
4782
|
+
var markers = [];
|
|
4783
|
+
var sectionAssemblers = /* @__PURE__ */ new Map();
|
|
4784
|
+
for(var packetStart = packetInfo.offset; packetStart + packetInfo.packetSize <= data.length; packetStart += packetInfo.packetSize){
|
|
4785
|
+
var tsStart = packetStart + packetInfo.tsPayloadOffset;
|
|
4786
|
+
if (data[tsStart] !== 71) {
|
|
4787
|
+
continue;
|
|
4788
|
+
}
|
|
4789
|
+
var secondByte = data[tsStart + 1];
|
|
4790
|
+
var thirdByte = data[tsStart + 2];
|
|
4791
|
+
var fourthByte = data[tsStart + 3];
|
|
4792
|
+
if (secondByte == null || thirdByte == null || fourthByte == null || (secondByte & 128) !== 0) {
|
|
4793
|
+
continue;
|
|
4794
|
+
}
|
|
4795
|
+
var payloadUnitStart = (secondByte & 64) !== 0;
|
|
4796
|
+
var pid = (secondByte & 31) << 8 | thirdByte;
|
|
4797
|
+
var adaptationFieldControl = fourthByte >> 4 & 3;
|
|
4798
|
+
var hasPayload = adaptationFieldControl === 1 || adaptationFieldControl === 3;
|
|
4799
|
+
if (!hasPayload) {
|
|
4800
|
+
continue;
|
|
4801
|
+
}
|
|
4802
|
+
var payloadStart = tsStart + 4;
|
|
4803
|
+
if (adaptationFieldControl === 3) {
|
|
4804
|
+
var adaptationLength = data[payloadStart];
|
|
4805
|
+
if (adaptationLength == null) {
|
|
4806
|
+
continue;
|
|
4807
|
+
}
|
|
4808
|
+
payloadStart += 1 + adaptationLength;
|
|
4809
|
+
}
|
|
4810
|
+
var payloadEnd = Math.min(tsStart + 188, data.length);
|
|
4811
|
+
if (payloadStart >= payloadEnd || payloadStart >= data.length) {
|
|
4812
|
+
continue;
|
|
4813
|
+
}
|
|
4814
|
+
var payload = data.subarray(payloadStart, payloadEnd);
|
|
4815
|
+
if (pid === 0) {
|
|
4816
|
+
this.parsePatSection(payload, payloadUnitStart);
|
|
4817
|
+
} else if (this.pmtPids.has(pid)) {
|
|
4818
|
+
this.parsePmtSection(payload, payloadUnitStart);
|
|
4819
|
+
} else if (this.tsScte35Pids.has(pid)) {
|
|
4820
|
+
this.collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, sectionAssemblers, markers);
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4823
|
+
return markers;
|
|
4824
|
+
}
|
|
4825
|
+
},
|
|
4826
|
+
{
|
|
4827
|
+
key: "detectTsPacketFormat",
|
|
4828
|
+
value: function detectTsPacketFormat(data) {
|
|
4829
|
+
var packetSizes = [
|
|
4830
|
+
188,
|
|
4831
|
+
192,
|
|
4832
|
+
204
|
|
4833
|
+
];
|
|
4834
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4835
|
+
try {
|
|
4836
|
+
for(var _iterator = packetSizes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4837
|
+
var packetSize = _step.value;
|
|
4838
|
+
var tsPayloadOffset = packetSize === 192 ? 4 : 0;
|
|
4839
|
+
for(var offset = 0; offset < packetSize; offset++){
|
|
4840
|
+
var matchedPackets = 0;
|
|
4841
|
+
for(var packetStart = offset; packetStart + tsPayloadOffset < data.length && matchedPackets < 5; packetStart += packetSize){
|
|
4842
|
+
if (data[packetStart + tsPayloadOffset] !== 71) {
|
|
4843
|
+
break;
|
|
4844
|
+
}
|
|
4845
|
+
matchedPackets++;
|
|
4846
|
+
}
|
|
4847
|
+
if (matchedPackets >= 2) {
|
|
4848
|
+
return {
|
|
4849
|
+
offset: offset,
|
|
4850
|
+
packetSize: packetSize,
|
|
4851
|
+
tsPayloadOffset: tsPayloadOffset
|
|
4852
|
+
};
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
} catch (err) {
|
|
4857
|
+
_didIteratorError = true;
|
|
4858
|
+
_iteratorError = err;
|
|
4859
|
+
} finally{
|
|
4860
|
+
try {
|
|
4861
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4862
|
+
_iterator.return();
|
|
4863
|
+
}
|
|
4864
|
+
} finally{
|
|
4865
|
+
if (_didIteratorError) {
|
|
4866
|
+
throw _iteratorError;
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
return void 0;
|
|
4871
|
+
}
|
|
4872
|
+
},
|
|
4873
|
+
{
|
|
4874
|
+
key: "parsePatSection",
|
|
4875
|
+
value: function parsePatSection(payload, payloadUnitStart) {
|
|
4876
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4877
|
+
if (sectionStart == null || sectionStart + 8 >= payload.length) {
|
|
4878
|
+
return;
|
|
4879
|
+
}
|
|
4880
|
+
if (payload[sectionStart] !== 0) {
|
|
4881
|
+
return;
|
|
4882
|
+
}
|
|
4883
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4884
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4885
|
+
for(var offset = sectionStart + 8; offset + 4 <= sectionEnd - 4; offset += 4){
|
|
4886
|
+
var _payload_offset, _payload_, _payload_1, _payload_2;
|
|
4887
|
+
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);
|
|
4888
|
+
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);
|
|
4889
|
+
if (programNumber !== 0) {
|
|
4890
|
+
this.pmtPids.add(pid);
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
},
|
|
4895
|
+
{
|
|
4896
|
+
key: "parsePmtSection",
|
|
4897
|
+
value: function parsePmtSection(payload, payloadUnitStart) {
|
|
4898
|
+
var _payload_, _payload_1;
|
|
4899
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4900
|
+
if (sectionStart == null || sectionStart + 12 >= payload.length) {
|
|
4901
|
+
return;
|
|
4902
|
+
}
|
|
4903
|
+
if (payload[sectionStart] !== 2) {
|
|
4904
|
+
return;
|
|
4905
|
+
}
|
|
4906
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4907
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4908
|
+
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);
|
|
4909
|
+
var offset = sectionStart + 12 + programInfoLength;
|
|
4910
|
+
while(offset + 5 <= sectionEnd - 4){
|
|
4911
|
+
var _payload_offset, _payload_2, _payload_3, _payload_4, _payload_5;
|
|
4912
|
+
var streamType = (_payload_offset = payload[offset]) !== null && _payload_offset !== void 0 ? _payload_offset : 0;
|
|
4913
|
+
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);
|
|
4914
|
+
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);
|
|
4915
|
+
var descriptorStart = offset + 5;
|
|
4916
|
+
var descriptorEnd = Math.min(descriptorStart + esInfoLength, sectionEnd - 4);
|
|
4917
|
+
if (streamType === 134 || streamType === 6 && this.descriptorsIdentifyScte35(payload, descriptorStart, descriptorEnd)) {
|
|
4918
|
+
this.tsScte35Pids.add(elementaryPid);
|
|
4919
|
+
}
|
|
4920
|
+
offset = descriptorStart + esInfoLength;
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
},
|
|
4924
|
+
{
|
|
4925
|
+
key: "descriptorsIdentifyScte35",
|
|
4926
|
+
value: function descriptorsIdentifyScte35(data, start, end) {
|
|
4927
|
+
var offset = start;
|
|
4928
|
+
while(offset + 2 <= end){
|
|
4929
|
+
var _data_offset, _data_, _data_descriptorStart, _data_1, _data_2, _data_3;
|
|
4930
|
+
var tag = (_data_offset = data[offset]) !== null && _data_offset !== void 0 ? _data_offset : 0;
|
|
4931
|
+
var length = (_data_ = data[offset + 1]) !== null && _data_ !== void 0 ? _data_ : 0;
|
|
4932
|
+
var descriptorStart = offset + 2;
|
|
4933
|
+
var descriptorEnd = descriptorStart + length;
|
|
4934
|
+
if (descriptorEnd > end) {
|
|
4935
|
+
return false;
|
|
4936
|
+
}
|
|
4937
|
+
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) : "";
|
|
4938
|
+
if (tag === 138 || registration === "CUEI" || registration === "SCTE") {
|
|
4939
|
+
return true;
|
|
4940
|
+
}
|
|
4941
|
+
offset = descriptorEnd;
|
|
4942
|
+
}
|
|
4943
|
+
return false;
|
|
4944
|
+
}
|
|
4945
|
+
},
|
|
4946
|
+
{
|
|
4947
|
+
key: "collectScte35SectionsFromPayload",
|
|
4948
|
+
value: function collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, assemblers, markers) {
|
|
4949
|
+
if (payload.length === 0) {
|
|
4950
|
+
return;
|
|
4951
|
+
}
|
|
4952
|
+
var offset = 0;
|
|
4953
|
+
if (payloadUnitStart) {
|
|
4954
|
+
var _payload_;
|
|
4955
|
+
var pointerField = (_payload_ = payload[0]) !== null && _payload_ !== void 0 ? _payload_ : 0;
|
|
4956
|
+
var previousAssembler = assemblers.get(pid);
|
|
4957
|
+
if (previousAssembler && pointerField > 0) {
|
|
4958
|
+
this.appendScte35Bytes(pid, payload.subarray(1, Math.min(1 + pointerField, payload.length)), assemblers, markers);
|
|
4959
|
+
}
|
|
4960
|
+
assemblers.delete(pid);
|
|
4961
|
+
offset = 1 + pointerField;
|
|
4962
|
+
} else {
|
|
4963
|
+
this.appendScte35Bytes(pid, payload, assemblers, markers);
|
|
4964
|
+
return;
|
|
4965
|
+
}
|
|
4966
|
+
while(offset + 3 <= payload.length){
|
|
4967
|
+
var tableId = payload[offset];
|
|
4968
|
+
if (tableId == null || tableId === 255) {
|
|
4969
|
+
return;
|
|
4970
|
+
}
|
|
4971
|
+
var sectionLength = this.getPsiSectionLength(payload, offset);
|
|
4972
|
+
var totalLength = 3 + sectionLength;
|
|
4973
|
+
if (sectionLength <= 0 || totalLength <= 3) {
|
|
4974
|
+
return;
|
|
4975
|
+
}
|
|
4976
|
+
if (offset + totalLength <= payload.length) {
|
|
4977
|
+
this.addScte35SectionMarker(payload.subarray(offset, offset + totalLength), markers);
|
|
4978
|
+
offset += totalLength;
|
|
4979
|
+
} else {
|
|
4980
|
+
assemblers.set(pid, {
|
|
4981
|
+
bytes: Array.from(payload.subarray(offset)),
|
|
4982
|
+
expectedLength: totalLength
|
|
4983
|
+
});
|
|
4984
|
+
return;
|
|
4985
|
+
}
|
|
4986
|
+
}
|
|
4987
|
+
}
|
|
4988
|
+
},
|
|
4989
|
+
{
|
|
4990
|
+
key: "appendScte35Bytes",
|
|
4991
|
+
value: function appendScte35Bytes(pid, bytes, assemblers, markers) {
|
|
4992
|
+
var assembler = assemblers.get(pid);
|
|
4993
|
+
if (!assembler) {
|
|
4994
|
+
return;
|
|
4995
|
+
}
|
|
4996
|
+
for(var i = 0; i < bytes.length && assembler.bytes.length < assembler.expectedLength; i++){
|
|
4997
|
+
var _bytes_i;
|
|
4998
|
+
assembler.bytes.push((_bytes_i = bytes[i]) !== null && _bytes_i !== void 0 ? _bytes_i : 0);
|
|
4999
|
+
}
|
|
5000
|
+
if (assembler.bytes.length >= assembler.expectedLength) {
|
|
5001
|
+
assemblers.delete(pid);
|
|
5002
|
+
this.addScte35SectionMarker(new Uint8Array(assembler.bytes), markers);
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
},
|
|
5006
|
+
{
|
|
5007
|
+
key: "addScte35SectionMarker",
|
|
5008
|
+
value: function addScte35SectionMarker(section, markers) {
|
|
5009
|
+
if (section[0] !== 252 || this.hasProcessedTsScte35Section(section)) {
|
|
5010
|
+
return;
|
|
5011
|
+
}
|
|
5012
|
+
var marker = this.parseScte35Binary(section);
|
|
5013
|
+
if (!marker) {
|
|
5014
|
+
return;
|
|
5015
|
+
}
|
|
5016
|
+
marker.raw = _object_spread_props(_object_spread({}, _type_of(marker.raw) === "object" && marker.raw ? marker.raw : {}), {
|
|
5017
|
+
source: "ts-packet"
|
|
5018
|
+
});
|
|
5019
|
+
markers.push(marker);
|
|
5020
|
+
}
|
|
5021
|
+
},
|
|
5022
|
+
{
|
|
5023
|
+
key: "hasProcessedTsScte35Section",
|
|
5024
|
+
value: function hasProcessedTsScte35Section(section) {
|
|
5025
|
+
var checksum = 0;
|
|
5026
|
+
for(var i = 0; i < section.length; i++){
|
|
5027
|
+
var _section_i;
|
|
5028
|
+
checksum = checksum * 31 + ((_section_i = section[i]) !== null && _section_i !== void 0 ? _section_i : 0) >>> 0;
|
|
5029
|
+
}
|
|
5030
|
+
var key = "".concat(section.length, ":").concat(checksum);
|
|
5031
|
+
if (this.processedTsScte35Sections.has(key)) {
|
|
5032
|
+
return true;
|
|
5033
|
+
}
|
|
5034
|
+
this.processedTsScte35Sections.add(key);
|
|
5035
|
+
if (this.processedTsScte35Sections.size > 200) {
|
|
5036
|
+
var firstKey = this.processedTsScte35Sections.values().next().value;
|
|
5037
|
+
if (firstKey) {
|
|
5038
|
+
this.processedTsScte35Sections.delete(firstKey);
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
5041
|
+
return false;
|
|
5042
|
+
}
|
|
5043
|
+
},
|
|
5044
|
+
{
|
|
5045
|
+
key: "getPsiSectionStart",
|
|
5046
|
+
value: function getPsiSectionStart(payload, payloadUnitStart) {
|
|
5047
|
+
if (!payloadUnitStart) {
|
|
5048
|
+
return void 0;
|
|
5049
|
+
}
|
|
5050
|
+
var pointerField = payload[0];
|
|
5051
|
+
if (pointerField == null) {
|
|
5052
|
+
return void 0;
|
|
5053
|
+
}
|
|
5054
|
+
var sectionStart = 1 + pointerField;
|
|
5055
|
+
return sectionStart < payload.length ? sectionStart : void 0;
|
|
5056
|
+
}
|
|
5057
|
+
},
|
|
5058
|
+
{
|
|
5059
|
+
key: "getPsiSectionLength",
|
|
5060
|
+
value: function getPsiSectionLength(data, offset) {
|
|
5061
|
+
var _data_, _data_1;
|
|
5062
|
+
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);
|
|
5063
|
+
}
|
|
5064
|
+
},
|
|
4462
5065
|
{
|
|
4463
5066
|
key: "parseScte35Binary",
|
|
4464
5067
|
value: function parseScte35Binary(data) {
|
|
@@ -4498,10 +5101,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4498
5101
|
value: function skipBits(n) {
|
|
4499
5102
|
this.readBits(n);
|
|
4500
5103
|
}
|
|
5104
|
+
},
|
|
5105
|
+
{
|
|
5106
|
+
key: "bytePosition",
|
|
5107
|
+
get: function get() {
|
|
5108
|
+
return this.bitPos === 0 ? this.bytePos : this.bytePos + 1;
|
|
5109
|
+
}
|
|
4501
5110
|
}
|
|
4502
5111
|
]);
|
|
4503
5112
|
return BitReader;
|
|
4504
5113
|
}();
|
|
5114
|
+
var readSpliceTime = function readSpliceTime(r2, ptsAdjustmentTicks2) {
|
|
5115
|
+
var timeSpecifiedFlag = r2.readBits(1) === 1;
|
|
5116
|
+
if (!timeSpecifiedFlag) {
|
|
5117
|
+
r2.readBits(7);
|
|
5118
|
+
return void 0;
|
|
5119
|
+
}
|
|
5120
|
+
r2.readBits(6);
|
|
5121
|
+
var high = r2.readBits(1);
|
|
5122
|
+
var low = r2.readBits(32);
|
|
5123
|
+
var ptsTicks = (high * 4294967296 + low + ptsAdjustmentTicks2) % 8589934592;
|
|
5124
|
+
return ptsTicks / 9e4;
|
|
5125
|
+
};
|
|
4505
5126
|
var r = new BitReader(data);
|
|
4506
5127
|
var tableId = r.readBits(8);
|
|
4507
5128
|
if (tableId !== 252) return void 0;
|
|
@@ -4509,77 +5130,206 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4509
5130
|
r.readBits(1);
|
|
4510
5131
|
r.readBits(2);
|
|
4511
5132
|
var sectionLength = r.readBits(12);
|
|
5133
|
+
if (sectionLength <= 0 || data.length < 3 + sectionLength) {
|
|
5134
|
+
return void 0;
|
|
5135
|
+
}
|
|
4512
5136
|
r.readBits(8);
|
|
4513
5137
|
r.readBits(1);
|
|
4514
5138
|
r.readBits(6);
|
|
4515
5139
|
var ptsAdjHigh = r.readBits(1);
|
|
4516
5140
|
var ptsAdjLow = r.readBits(32);
|
|
4517
|
-
|
|
4518
|
-
void ptsAdjLow;
|
|
5141
|
+
var ptsAdjustmentTicks = ptsAdjHigh * 4294967296 + ptsAdjLow;
|
|
4519
5142
|
r.readBits(8);
|
|
4520
5143
|
r.readBits(12);
|
|
4521
5144
|
var spliceCommandLength = r.readBits(12);
|
|
4522
5145
|
var spliceCommandType = r.readBits(8);
|
|
4523
|
-
|
|
5146
|
+
var markerType;
|
|
5147
|
+
var durationSeconds = void 0;
|
|
5148
|
+
var ptsSeconds = void 0;
|
|
5149
|
+
var spliceEventId = void 0;
|
|
5150
|
+
var commandBodyStart = r.bytePosition;
|
|
5151
|
+
if (spliceCommandType === 5) {
|
|
5152
|
+
spliceEventId = r.readBits(32);
|
|
5153
|
+
var cancel = r.readBits(1) === 1;
|
|
5154
|
+
r.readBits(7);
|
|
5155
|
+
if (cancel) return void 0;
|
|
5156
|
+
var outOfNetwork = r.readBits(1) === 1;
|
|
5157
|
+
var programSpliceFlag = r.readBits(1) === 1;
|
|
5158
|
+
var durationFlag = r.readBits(1) === 1;
|
|
5159
|
+
var spliceImmediateFlag = r.readBits(1) === 1;
|
|
5160
|
+
r.readBits(4);
|
|
5161
|
+
markerType = outOfNetwork ? "start" : "end";
|
|
5162
|
+
if (programSpliceFlag && !spliceImmediateFlag) {
|
|
5163
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5164
|
+
} else if (!programSpliceFlag) {
|
|
5165
|
+
var componentCount = r.readBits(8);
|
|
5166
|
+
for(var i = 0; i < componentCount; i++){
|
|
5167
|
+
r.readBits(8);
|
|
5168
|
+
if (!spliceImmediateFlag) {
|
|
5169
|
+
var componentPtsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5170
|
+
if (ptsSeconds === void 0) {
|
|
5171
|
+
ptsSeconds = componentPtsSeconds;
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
}
|
|
5175
|
+
}
|
|
5176
|
+
if (durationFlag) {
|
|
5177
|
+
r.readBits(6);
|
|
5178
|
+
r.readBits(1);
|
|
5179
|
+
var high = r.readBits(1);
|
|
5180
|
+
var low = r.readBits(32);
|
|
5181
|
+
var durationTicks = high * 4294967296 + low;
|
|
5182
|
+
durationSeconds = durationTicks / 9e4;
|
|
5183
|
+
}
|
|
5184
|
+
r.readBits(16);
|
|
5185
|
+
r.readBits(8);
|
|
5186
|
+
r.readBits(8);
|
|
5187
|
+
} else if (spliceCommandType === 6) {
|
|
5188
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5189
|
+
} else {
|
|
4524
5190
|
return void 0;
|
|
4525
5191
|
}
|
|
4526
|
-
r.
|
|
4527
|
-
var
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
}
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
5192
|
+
var expectedDescriptorOffset = spliceCommandLength === 4095 ? r.bytePosition : commandBodyStart + spliceCommandLength;
|
|
5193
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptors(data, expectedDescriptorOffset);
|
|
5194
|
+
if (descriptorMarker) {
|
|
5195
|
+
markerType = descriptorMarker.type;
|
|
5196
|
+
if (durationSeconds === void 0) {
|
|
5197
|
+
durationSeconds = descriptorMarker.durationSeconds;
|
|
5198
|
+
}
|
|
5199
|
+
}
|
|
5200
|
+
if (!markerType) {
|
|
5201
|
+
return void 0;
|
|
5202
|
+
}
|
|
5203
|
+
var marker = _object_spread_props(_object_spread({
|
|
5204
|
+
type: markerType
|
|
5205
|
+
}, ptsSeconds !== void 0 ? {
|
|
5206
|
+
ptsSeconds: ptsSeconds
|
|
5207
|
+
} : {}, durationSeconds !== void 0 ? {
|
|
5208
|
+
durationSeconds: durationSeconds
|
|
5209
|
+
} : {}), {
|
|
5210
|
+
raw: _object_spread({
|
|
5211
|
+
splice_command_type: spliceCommandType
|
|
5212
|
+
}, spliceEventId !== void 0 ? {
|
|
5213
|
+
splice_event_id: spliceEventId
|
|
5214
|
+
} : {}, (descriptorMarker === null || descriptorMarker === void 0 ? void 0 : descriptorMarker.segmentationEventId) !== void 0 ? {
|
|
5215
|
+
segmentation_event_id: descriptorMarker.segmentationEventId
|
|
5216
|
+
} : {})
|
|
5217
|
+
});
|
|
5218
|
+
return marker;
|
|
5219
|
+
}
|
|
5220
|
+
},
|
|
5221
|
+
{
|
|
5222
|
+
key: "parseScte35SegmentationDescriptors",
|
|
5223
|
+
value: function parseScte35SegmentationDescriptors(data, offset) {
|
|
5224
|
+
var _data_offset, _data_;
|
|
5225
|
+
if (offset + 2 > data.length) {
|
|
5226
|
+
return void 0;
|
|
5227
|
+
}
|
|
5228
|
+
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);
|
|
5229
|
+
var descriptorOffset = offset + 2;
|
|
5230
|
+
var descriptorEnd = Math.min(data.length, descriptorOffset + descriptorLoopLength);
|
|
5231
|
+
while(descriptorOffset + 2 <= descriptorEnd){
|
|
5232
|
+
var _data_descriptorOffset, _data_1;
|
|
5233
|
+
var descriptorTag = (_data_descriptorOffset = data[descriptorOffset]) !== null && _data_descriptorOffset !== void 0 ? _data_descriptorOffset : 0;
|
|
5234
|
+
var descriptorLength = (_data_1 = data[descriptorOffset + 1]) !== null && _data_1 !== void 0 ? _data_1 : 0;
|
|
5235
|
+
var descriptorDataStart = descriptorOffset + 2;
|
|
5236
|
+
var descriptorDataEnd = descriptorDataStart + descriptorLength;
|
|
5237
|
+
if (descriptorDataEnd > descriptorEnd) {
|
|
5238
|
+
return void 0;
|
|
5239
|
+
}
|
|
5240
|
+
if (descriptorTag === 2) {
|
|
5241
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptor(data.subarray(descriptorDataStart, descriptorDataEnd));
|
|
5242
|
+
if (descriptorMarker) {
|
|
5243
|
+
return descriptorMarker;
|
|
4555
5244
|
}
|
|
4556
5245
|
}
|
|
5246
|
+
descriptorOffset = descriptorDataEnd;
|
|
5247
|
+
}
|
|
5248
|
+
return void 0;
|
|
5249
|
+
}
|
|
5250
|
+
},
|
|
5251
|
+
{
|
|
5252
|
+
key: "parseScte35SegmentationDescriptor",
|
|
5253
|
+
value: function parseScte35SegmentationDescriptor(descriptor) {
|
|
5254
|
+
var _descriptor_, _descriptor_1, _descriptor_2, _descriptor_3, _descriptor_4, _descriptor_5, _descriptor_6, _descriptor_7, _descriptor_8, _descriptor_9, _descriptor_offset, _descriptor_offset1;
|
|
5255
|
+
if (descriptor.length < 11) {
|
|
5256
|
+
return void 0;
|
|
5257
|
+
}
|
|
5258
|
+
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);
|
|
5259
|
+
if (identifier !== "CUEI") {
|
|
5260
|
+
return void 0;
|
|
5261
|
+
}
|
|
5262
|
+
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);
|
|
5263
|
+
var cancelIndicator = (((_descriptor_8 = descriptor[8]) !== null && _descriptor_8 !== void 0 ? _descriptor_8 : 0) & 128) !== 0;
|
|
5264
|
+
if (cancelIndicator) {
|
|
5265
|
+
return void 0;
|
|
5266
|
+
}
|
|
5267
|
+
var flags = (_descriptor_9 = descriptor[9]) !== null && _descriptor_9 !== void 0 ? _descriptor_9 : 0;
|
|
5268
|
+
var programSegmentationFlag = (flags & 128) !== 0;
|
|
5269
|
+
var segmentationDurationFlag = (flags & 64) !== 0;
|
|
5270
|
+
var offset = 10;
|
|
5271
|
+
if (!programSegmentationFlag) {
|
|
5272
|
+
var _descriptor_offset2;
|
|
5273
|
+
var componentCount = (_descriptor_offset2 = descriptor[offset]) !== null && _descriptor_offset2 !== void 0 ? _descriptor_offset2 : 0;
|
|
5274
|
+
offset += 1 + componentCount * 6;
|
|
5275
|
+
if (offset > descriptor.length) {
|
|
5276
|
+
return void 0;
|
|
5277
|
+
}
|
|
4557
5278
|
}
|
|
4558
5279
|
var durationSeconds = void 0;
|
|
4559
|
-
if (
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
var durationTicks =
|
|
5280
|
+
if (segmentationDurationFlag) {
|
|
5281
|
+
var _descriptor_offset3, _descriptor_10, _descriptor_11, _descriptor_12, _descriptor_13;
|
|
5282
|
+
if (offset + 5 > descriptor.length) {
|
|
5283
|
+
return void 0;
|
|
5284
|
+
}
|
|
5285
|
+
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);
|
|
4565
5286
|
durationSeconds = durationTicks / 9e4;
|
|
5287
|
+
offset += 5;
|
|
4566
5288
|
}
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
5289
|
+
if (offset + 2 > descriptor.length) {
|
|
5290
|
+
return void 0;
|
|
5291
|
+
}
|
|
5292
|
+
offset += 1;
|
|
5293
|
+
var segmentationUpidLength = (_descriptor_offset = descriptor[offset]) !== null && _descriptor_offset !== void 0 ? _descriptor_offset : 0;
|
|
5294
|
+
offset += 1 + segmentationUpidLength;
|
|
5295
|
+
if (offset >= descriptor.length) {
|
|
5296
|
+
return void 0;
|
|
5297
|
+
}
|
|
5298
|
+
var segmentationTypeId = (_descriptor_offset1 = descriptor[offset]) !== null && _descriptor_offset1 !== void 0 ? _descriptor_offset1 : 0;
|
|
5299
|
+
var markerType = this.markerTypeFromSegmentationTypeId(segmentationTypeId);
|
|
5300
|
+
if (!markerType) {
|
|
5301
|
+
return void 0;
|
|
5302
|
+
}
|
|
5303
|
+
return _object_spread_props(_object_spread({
|
|
5304
|
+
type: markerType
|
|
5305
|
+
}, durationSeconds !== void 0 ? {
|
|
5306
|
+
durationSeconds: durationSeconds
|
|
5307
|
+
} : {}), {
|
|
5308
|
+
segmentationEventId: segmentationEventId
|
|
5309
|
+
});
|
|
5310
|
+
}
|
|
5311
|
+
},
|
|
5312
|
+
{
|
|
5313
|
+
key: "markerTypeFromSegmentationTypeId",
|
|
5314
|
+
value: function markerTypeFromSegmentationTypeId(segmentationTypeId) {
|
|
5315
|
+
switch(segmentationTypeId){
|
|
5316
|
+
case 16:
|
|
5317
|
+
case 34:
|
|
5318
|
+
case 48:
|
|
5319
|
+
case 50:
|
|
5320
|
+
case 52:
|
|
5321
|
+
case 54:
|
|
5322
|
+
return "start";
|
|
5323
|
+
case 17:
|
|
5324
|
+
case 35:
|
|
5325
|
+
case 49:
|
|
5326
|
+
case 51:
|
|
5327
|
+
case 53:
|
|
5328
|
+
case 55:
|
|
5329
|
+
return "end";
|
|
5330
|
+
default:
|
|
5331
|
+
return void 0;
|
|
4581
5332
|
}
|
|
4582
|
-
return void 0;
|
|
4583
5333
|
}
|
|
4584
5334
|
},
|
|
4585
5335
|
{
|
|
@@ -4976,7 +5726,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4976
5726
|
},
|
|
4977
5727
|
{
|
|
4978
5728
|
key: "startAdPrefetch",
|
|
4979
|
-
value: function startAdPrefetch(marker, fragmentSn) {
|
|
5729
|
+
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
4980
5730
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
4981
5731
|
return;
|
|
4982
5732
|
}
|
|
@@ -5004,6 +5754,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5004
5754
|
isFetching: false,
|
|
5005
5755
|
fetchStartTime: Date.now()
|
|
5006
5756
|
});
|
|
5757
|
+
this.pendingScte35CueKey = cueKey;
|
|
5007
5758
|
this.adDetectSentForCurrentBreak = true;
|
|
5008
5759
|
var detectPayload = {};
|
|
5009
5760
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
@@ -5025,6 +5776,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5025
5776
|
this.prefetchTimerId = void 0;
|
|
5026
5777
|
}
|
|
5027
5778
|
this.pendingAdBreak = null;
|
|
5779
|
+
this.pendingScte35CueKey = void 0;
|
|
5028
5780
|
}
|
|
5029
5781
|
},
|
|
5030
5782
|
{
|
|
@@ -6508,18 +7260,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6508
7260
|
key: "scheduleAdStartIn",
|
|
6509
7261
|
value: function scheduleAdStartIn(delayMs) {
|
|
6510
7262
|
var _this = this;
|
|
7263
|
+
var marker = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7264
|
+
type: "start"
|
|
7265
|
+
}, cueKey = arguments.length > 2 ? arguments[2] : void 0;
|
|
6511
7266
|
this.clearAdStartTimer();
|
|
6512
7267
|
var ms = Math.max(0, Math.floor(delayMs));
|
|
6513
7268
|
if (ms === 0) {
|
|
6514
|
-
this.
|
|
6515
|
-
type: "start"
|
|
6516
|
-
}).catch(function() {});
|
|
7269
|
+
this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0);
|
|
6517
7270
|
return;
|
|
6518
7271
|
}
|
|
6519
7272
|
this.adStartTimerId = window.setTimeout(function() {
|
|
6520
|
-
_this.
|
|
6521
|
-
type: "start"
|
|
6522
|
-
}).catch(function() {});
|
|
7273
|
+
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.expectedAdBreakDurationMs);
|
|
6523
7274
|
}, ms);
|
|
6524
7275
|
}
|
|
6525
7276
|
},
|
|
@@ -6950,6 +7701,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6950
7701
|
this.adRequestQueue = [];
|
|
6951
7702
|
this.inAdBreak = false;
|
|
6952
7703
|
this.adDetectSentForCurrentBreak = false;
|
|
7704
|
+
this.activeScte35BreakKey = void 0;
|
|
7705
|
+
this.scheduledScte35BreakKey = void 0;
|
|
6953
7706
|
this.expectedAdBreakDurationMs = void 0;
|
|
6954
7707
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
6955
7708
|
this.clearAdStartTimer();
|