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
|
@@ -3276,6 +3276,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3276
3276
|
this.adRequestQueue = [];
|
|
3277
3277
|
this.maxPlaceholderDurationMs = 5e3;
|
|
3278
3278
|
this.isShowingPlaceholder = false;
|
|
3279
|
+
this.tsScte35Pids = /* @__PURE__ */ new Set();
|
|
3280
|
+
this.pmtPids = /* @__PURE__ */ new Set();
|
|
3281
|
+
this.processedTsScte35Sections = /* @__PURE__ */ new Set();
|
|
3282
|
+
this.pendingScte35Cues = /* @__PURE__ */ new Map();
|
|
3283
|
+
this.recentScte35CueKeys = /* @__PURE__ */ new Map();
|
|
3284
|
+
this.recentScte35CueLimit = 200;
|
|
3279
3285
|
this.totalAdRequestsInBreak = 0;
|
|
3280
3286
|
this.maxTotalAdRequestsPerBreak = 10;
|
|
3281
3287
|
this.pendingAdBreak = null;
|
|
@@ -3545,7 +3551,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3545
3551
|
if (_this.config.debugAdTiming) {
|
|
3546
3552
|
console.log("[StormcloudVideoPlayer] \uD83C\uDFAF EARLY SCTE-35 DETECTION: Ad break marker found in fragment", i, "- starting pre-fetch (NOT playing yet)");
|
|
3547
3553
|
}
|
|
3548
|
-
_this.
|
|
3554
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "early", frag)));
|
|
3549
3555
|
return;
|
|
3550
3556
|
}
|
|
3551
3557
|
}
|
|
@@ -3626,10 +3632,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3626
3632
|
return _this.onId3Tag(tag);
|
|
3627
3633
|
});
|
|
3628
3634
|
});
|
|
3635
|
+
this.hls.on(import_hls2.default.Events.FRAG_LOADED, function(_evt, data) {
|
|
3636
|
+
var _data_frag;
|
|
3637
|
+
_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));
|
|
3638
|
+
});
|
|
3639
|
+
this.hls.on(import_hls2.default.Events.FRAG_DECRYPTED, function(_evt, data) {
|
|
3640
|
+
var _data_frag;
|
|
3641
|
+
_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));
|
|
3642
|
+
});
|
|
3629
3643
|
this.hls.on(import_hls2.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3630
3644
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3631
3645
|
var tagList = frag === null || frag === void 0 ? void 0 : frag.tagList;
|
|
3632
|
-
if (!Array.isArray(tagList))
|
|
3646
|
+
if (!Array.isArray(tagList)) {
|
|
3647
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3648
|
+
return;
|
|
3649
|
+
}
|
|
3633
3650
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3634
3651
|
try {
|
|
3635
3652
|
for(var _iterator = tagList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -3665,7 +3682,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3665
3682
|
value: value
|
|
3666
3683
|
}
|
|
3667
3684
|
});
|
|
3668
|
-
_this.
|
|
3685
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3669
3686
|
} else if (tag.includes("EXT-X-CUE-OUT")) {
|
|
3670
3687
|
var durationSeconds = _this.parseCueOutDuration(value);
|
|
3671
3688
|
var marker1 = _object_spread_props(_object_spread({
|
|
@@ -3678,15 +3695,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3678
3695
|
value: value
|
|
3679
3696
|
}
|
|
3680
3697
|
});
|
|
3681
|
-
_this.
|
|
3698
|
+
_this.onScte35Cue(marker1, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3682
3699
|
} else if (tag.includes("EXT-X-CUE-IN")) {
|
|
3683
|
-
_this.
|
|
3700
|
+
_this.onScte35Cue({
|
|
3684
3701
|
type: "end",
|
|
3685
3702
|
raw: {
|
|
3686
3703
|
tag: tag,
|
|
3687
3704
|
value: value
|
|
3688
3705
|
}
|
|
3689
|
-
});
|
|
3706
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3690
3707
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
3691
3708
|
var _attrs_CLASS;
|
|
3692
3709
|
var attrs = _this.parseAttributeList(value);
|
|
@@ -3706,17 +3723,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3706
3723
|
attrs: attrs
|
|
3707
3724
|
}
|
|
3708
3725
|
});
|
|
3709
|
-
_this.
|
|
3726
|
+
_this.onScte35Cue(marker2, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3710
3727
|
}
|
|
3711
3728
|
if (hasScteIn) {
|
|
3712
|
-
_this.
|
|
3729
|
+
_this.onScte35Cue({
|
|
3713
3730
|
type: "end",
|
|
3714
3731
|
raw: {
|
|
3715
3732
|
tag: tag,
|
|
3716
3733
|
value: value,
|
|
3717
3734
|
attrs: attrs
|
|
3718
3735
|
}
|
|
3719
|
-
});
|
|
3736
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3720
3737
|
}
|
|
3721
3738
|
}
|
|
3722
3739
|
}
|
|
@@ -3734,6 +3751,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3734
3751
|
}
|
|
3735
3752
|
}
|
|
3736
3753
|
}
|
|
3754
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3737
3755
|
});
|
|
3738
3756
|
this.hls.on(import_hls2.default.Events.ERROR, function(_evt, data) {
|
|
3739
3757
|
if (data === null || data === void 0 ? void 0 : data.fatal) {
|
|
@@ -4039,7 +4057,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4039
4057
|
}
|
|
4040
4058
|
var marker = this.parseScte35FromId3(tag);
|
|
4041
4059
|
if (marker) {
|
|
4042
|
-
this.
|
|
4060
|
+
this.onScte35Cue(marker, {
|
|
4061
|
+
source: "id3",
|
|
4062
|
+
readiness: "playback"
|
|
4063
|
+
});
|
|
4043
4064
|
}
|
|
4044
4065
|
}
|
|
4045
4066
|
},
|
|
@@ -4183,9 +4204,251 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4183
4204
|
}
|
|
4184
4205
|
}
|
|
4185
4206
|
},
|
|
4207
|
+
{
|
|
4208
|
+
key: "createScte35CueContext",
|
|
4209
|
+
value: function createScte35CueContext(source, readiness, frag) {
|
|
4210
|
+
var context = {
|
|
4211
|
+
source: source,
|
|
4212
|
+
readiness: readiness
|
|
4213
|
+
};
|
|
4214
|
+
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
4215
|
+
context.fragmentSn = frag.sn;
|
|
4216
|
+
}
|
|
4217
|
+
var fragmentStartSeconds = this.getFragmentStartSeconds(frag);
|
|
4218
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4219
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4220
|
+
}
|
|
4221
|
+
return context;
|
|
4222
|
+
}
|
|
4223
|
+
},
|
|
4224
|
+
{
|
|
4225
|
+
key: "getFragmentStartSeconds",
|
|
4226
|
+
value: function getFragmentStartSeconds(frag) {
|
|
4227
|
+
var candidates = [
|
|
4228
|
+
frag === null || frag === void 0 ? void 0 : frag.start,
|
|
4229
|
+
frag === null || frag === void 0 ? void 0 : frag.startPTS
|
|
4230
|
+
];
|
|
4231
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4232
|
+
try {
|
|
4233
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4234
|
+
var candidate = _step.value;
|
|
4235
|
+
if (typeof candidate === "number" && Number.isFinite(candidate)) {
|
|
4236
|
+
return candidate;
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
} catch (err) {
|
|
4240
|
+
_didIteratorError = true;
|
|
4241
|
+
_iteratorError = err;
|
|
4242
|
+
} finally{
|
|
4243
|
+
try {
|
|
4244
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4245
|
+
_iterator.return();
|
|
4246
|
+
}
|
|
4247
|
+
} finally{
|
|
4248
|
+
if (_didIteratorError) {
|
|
4249
|
+
throw _iteratorError;
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
return void 0;
|
|
4254
|
+
}
|
|
4255
|
+
},
|
|
4256
|
+
{
|
|
4257
|
+
key: "onScte35Cue",
|
|
4258
|
+
value: function onScte35Cue(marker, context) {
|
|
4259
|
+
var cue = this.createScte35Cue(marker, context);
|
|
4260
|
+
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
4261
|
+
if (context.readiness === "early") {
|
|
4262
|
+
this.pendingScte35Cues.set(pendingKey, cue);
|
|
4263
|
+
this.trimRecentScte35CueMaps();
|
|
4264
|
+
if (marker.type === "start") {
|
|
4265
|
+
this.startAdPrefetch(marker, context.fragmentSn, cue.key);
|
|
4266
|
+
}
|
|
4267
|
+
return;
|
|
4268
|
+
}
|
|
4269
|
+
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
4270
|
+
if (this.config.debugAdTiming) {
|
|
4271
|
+
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
4272
|
+
key: cue.key,
|
|
4273
|
+
activeScte35BreakKey: this.activeScte35BreakKey,
|
|
4274
|
+
inAdBreak: this.inAdBreak,
|
|
4275
|
+
source: cue.source
|
|
4276
|
+
});
|
|
4277
|
+
}
|
|
4278
|
+
return;
|
|
4279
|
+
}
|
|
4280
|
+
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
4281
|
+
if (this.config.debugAdTiming) {
|
|
4282
|
+
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
4283
|
+
key: cue.key,
|
|
4284
|
+
source: cue.source
|
|
4285
|
+
});
|
|
4286
|
+
}
|
|
4287
|
+
return;
|
|
4288
|
+
}
|
|
4289
|
+
this.pendingScte35Cues.delete(pendingKey);
|
|
4290
|
+
this.markScte35CueHandled(cue);
|
|
4291
|
+
this.onScte35Marker(marker, cue.key);
|
|
4292
|
+
}
|
|
4293
|
+
},
|
|
4294
|
+
{
|
|
4295
|
+
key: "createScte35Cue",
|
|
4296
|
+
value: function createScte35Cue(marker, context) {
|
|
4297
|
+
var cue = {
|
|
4298
|
+
marker: marker,
|
|
4299
|
+
source: context.source,
|
|
4300
|
+
readiness: context.readiness,
|
|
4301
|
+
key: this.getScte35CueKey(marker, context)
|
|
4302
|
+
};
|
|
4303
|
+
if (context.fragmentSn !== void 0) {
|
|
4304
|
+
cue.fragmentSn = context.fragmentSn;
|
|
4305
|
+
}
|
|
4306
|
+
if (context.fragmentStartSeconds !== void 0) {
|
|
4307
|
+
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
4308
|
+
}
|
|
4309
|
+
return cue;
|
|
4310
|
+
}
|
|
4311
|
+
},
|
|
4312
|
+
{
|
|
4313
|
+
key: "getScte35CueKey",
|
|
4314
|
+
value: function getScte35CueKey(marker, context) {
|
|
4315
|
+
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
4316
|
+
var raw = this.getScte35MarkerRaw(marker);
|
|
4317
|
+
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
4318
|
+
if (spliceEventId) {
|
|
4319
|
+
return "splice:".concat(spliceEventId);
|
|
4320
|
+
}
|
|
4321
|
+
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
4322
|
+
if (segmentationEventId) {
|
|
4323
|
+
return "segmentation:".concat(segmentationEventId);
|
|
4324
|
+
}
|
|
4325
|
+
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);
|
|
4326
|
+
if (daterangeId) {
|
|
4327
|
+
return "daterange:".concat(daterangeId);
|
|
4328
|
+
}
|
|
4329
|
+
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"]);
|
|
4330
|
+
if (scteValue) {
|
|
4331
|
+
return "daterange-scte:".concat(scteValue);
|
|
4332
|
+
}
|
|
4333
|
+
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
4334
|
+
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
4335
|
+
}
|
|
4336
|
+
if (context.fragmentSn !== void 0) {
|
|
4337
|
+
return "fragment:".concat(context.fragmentSn);
|
|
4338
|
+
}
|
|
4339
|
+
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4340
|
+
}
|
|
4341
|
+
},
|
|
4342
|
+
{
|
|
4343
|
+
key: "getPendingScte35CueKey",
|
|
4344
|
+
value: function getPendingScte35CueKey(cue) {
|
|
4345
|
+
return "".concat(cue.marker.type, ":").concat(cue.key, ":").concat(cue.fragmentSn !== void 0 ? cue.fragmentSn : "unknown");
|
|
4346
|
+
}
|
|
4347
|
+
},
|
|
4348
|
+
{
|
|
4349
|
+
key: "getScte35MarkerRaw",
|
|
4350
|
+
value: function getScte35MarkerRaw(marker) {
|
|
4351
|
+
return _type_of(marker.raw) === "object" && marker.raw !== null ? marker.raw : {};
|
|
4352
|
+
}
|
|
4353
|
+
},
|
|
4354
|
+
{
|
|
4355
|
+
key: "toIdentityString",
|
|
4356
|
+
value: function toIdentityString(value) {
|
|
4357
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4358
|
+
return String(value);
|
|
4359
|
+
}
|
|
4360
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
4361
|
+
return value.trim();
|
|
4362
|
+
}
|
|
4363
|
+
return void 0;
|
|
4364
|
+
}
|
|
4365
|
+
},
|
|
4366
|
+
{
|
|
4367
|
+
key: "isStrongScte35CueKey",
|
|
4368
|
+
value: function isStrongScte35CueKey(key) {
|
|
4369
|
+
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4370
|
+
}
|
|
4371
|
+
},
|
|
4372
|
+
{
|
|
4373
|
+
key: "hasRecentlyHandledScte35Cue",
|
|
4374
|
+
value: function hasRecentlyHandledScte35Cue(cue) {
|
|
4375
|
+
if (this.activeScte35BreakKey === cue.key || this.scheduledScte35BreakKey === cue.key) {
|
|
4376
|
+
return true;
|
|
4377
|
+
}
|
|
4378
|
+
var recentKey = "".concat(cue.marker.type, ":").concat(cue.key);
|
|
4379
|
+
return this.recentScte35CueKeys.has(recentKey);
|
|
4380
|
+
}
|
|
4381
|
+
},
|
|
4382
|
+
{
|
|
4383
|
+
key: "markScte35CueHandled",
|
|
4384
|
+
value: function markScte35CueHandled(cue) {
|
|
4385
|
+
this.recentScte35CueKeys.set("".concat(cue.marker.type, ":").concat(cue.key), Date.now());
|
|
4386
|
+
this.trimRecentScte35CueMaps();
|
|
4387
|
+
}
|
|
4388
|
+
},
|
|
4389
|
+
{
|
|
4390
|
+
key: "trimRecentScte35CueMaps",
|
|
4391
|
+
value: function trimRecentScte35CueMaps() {
|
|
4392
|
+
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
4393
|
+
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
4394
|
+
if (!firstKey) {
|
|
4395
|
+
break;
|
|
4396
|
+
}
|
|
4397
|
+
this.recentScte35CueKeys.delete(firstKey);
|
|
4398
|
+
}
|
|
4399
|
+
while(this.pendingScte35Cues.size > this.recentScte35CueLimit){
|
|
4400
|
+
var firstKey1 = this.pendingScte35Cues.keys().next().value;
|
|
4401
|
+
if (!firstKey1) {
|
|
4402
|
+
break;
|
|
4403
|
+
}
|
|
4404
|
+
this.pendingScte35Cues.delete(firstKey1);
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
},
|
|
4408
|
+
{
|
|
4409
|
+
key: "shouldAcceptScte35EndCue",
|
|
4410
|
+
value: function shouldAcceptScte35EndCue(cue) {
|
|
4411
|
+
if (!this.inAdBreak) {
|
|
4412
|
+
return false;
|
|
4413
|
+
}
|
|
4414
|
+
if (this.isStrongScte35CueKey(this.activeScte35BreakKey) && this.isStrongScte35CueKey(cue.key) && this.activeScte35BreakKey !== cue.key) {
|
|
4415
|
+
return false;
|
|
4416
|
+
}
|
|
4417
|
+
return true;
|
|
4418
|
+
}
|
|
4419
|
+
},
|
|
4420
|
+
{
|
|
4421
|
+
key: "activatePendingScte35CuesForFragment",
|
|
4422
|
+
value: function activatePendingScte35CuesForFragment(frag) {
|
|
4423
|
+
var _this = this;
|
|
4424
|
+
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
4425
|
+
if (fragmentSn === void 0) {
|
|
4426
|
+
return;
|
|
4427
|
+
}
|
|
4428
|
+
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
4429
|
+
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
4430
|
+
return cue.fragmentSn === fragmentSn;
|
|
4431
|
+
});
|
|
4432
|
+
matchingCues.forEach(function(param) {
|
|
4433
|
+
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
4434
|
+
var _cue_fragmentStartSeconds;
|
|
4435
|
+
_this.pendingScte35Cues.delete(pendingKey);
|
|
4436
|
+
var context = {
|
|
4437
|
+
source: cue.source,
|
|
4438
|
+
readiness: "playback"
|
|
4439
|
+
};
|
|
4440
|
+
context.fragmentSn = fragmentSn;
|
|
4441
|
+
var fragmentStartSeconds = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : _this.getFragmentStartSeconds(frag);
|
|
4442
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4443
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4444
|
+
}
|
|
4445
|
+
_this.onScte35Cue(cue.marker, context);
|
|
4446
|
+
});
|
|
4447
|
+
}
|
|
4448
|
+
},
|
|
4186
4449
|
{
|
|
4187
4450
|
key: "onScte35Marker",
|
|
4188
|
-
value: function onScte35Marker(marker) {
|
|
4451
|
+
value: function onScte35Marker(marker, cueKey) {
|
|
4189
4452
|
if (this.config.debugAdTiming) {
|
|
4190
4453
|
console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
|
|
4191
4454
|
type: marker.type,
|
|
@@ -4199,13 +4462,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4199
4462
|
if (marker.type === "start") {
|
|
4200
4463
|
var _this_config_immediateManifestAds;
|
|
4201
4464
|
var _this_pendingAdBreak;
|
|
4202
|
-
if (!this.video.muted) {
|
|
4203
|
-
this.video.muted = true;
|
|
4204
|
-
this.video.volume = 0;
|
|
4205
|
-
if (this.config.debugAdTiming) {
|
|
4206
|
-
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4207
|
-
}
|
|
4208
|
-
}
|
|
4209
4465
|
if (this.inAdBreak) {
|
|
4210
4466
|
if (marker.durationSeconds != null) {
|
|
4211
4467
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
@@ -4229,10 +4485,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4229
4485
|
sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
|
|
4230
4486
|
}
|
|
4231
4487
|
var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
|
|
4232
|
-
this.inAdBreak = true;
|
|
4233
4488
|
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;
|
|
4234
|
-
this.expectedAdBreakDurationMs = durationMs;
|
|
4235
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4236
4489
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
4237
4490
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
4238
4491
|
if (this.config.debugAdTiming) {
|
|
@@ -4248,7 +4501,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4248
4501
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (manifest-based)".concat(hasPrefetchedAds ? " with prefetched ads" : ""));
|
|
4249
4502
|
}
|
|
4250
4503
|
this.clearAdStartTimer();
|
|
4251
|
-
this.
|
|
4504
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4252
4505
|
} else if (typeof marker.ptsSeconds === "number") {
|
|
4253
4506
|
var _this_config_driftToleranceMs;
|
|
4254
4507
|
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
@@ -4268,23 +4521,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4268
4521
|
if (this.config.debugAdTiming) {
|
|
4269
4522
|
console.log("[StormcloudVideoPlayer] Scheduling ad start in ".concat(deltaMs, "ms"));
|
|
4270
4523
|
}
|
|
4271
|
-
this.
|
|
4524
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4525
|
+
this.scheduledScte35BreakKey = cueKey;
|
|
4526
|
+
this.scheduleAdStartIn(deltaMs, marker, cueKey);
|
|
4272
4527
|
} else {
|
|
4273
4528
|
if (this.config.debugAdTiming) {
|
|
4274
4529
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (within tolerance)");
|
|
4275
4530
|
}
|
|
4276
4531
|
this.clearAdStartTimer();
|
|
4277
|
-
this.
|
|
4532
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4278
4533
|
}
|
|
4279
4534
|
} else {
|
|
4280
4535
|
if (this.config.debugAdTiming) {
|
|
4281
4536
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (fallback)");
|
|
4282
4537
|
}
|
|
4283
4538
|
this.clearAdStartTimer();
|
|
4284
|
-
this.
|
|
4285
|
-
}
|
|
4286
|
-
if (this.expectedAdBreakDurationMs != null) {
|
|
4287
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4539
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4288
4540
|
}
|
|
4289
4541
|
return;
|
|
4290
4542
|
}
|
|
@@ -4340,6 +4592,27 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4340
4592
|
}
|
|
4341
4593
|
}
|
|
4342
4594
|
},
|
|
4595
|
+
{
|
|
4596
|
+
key: "startScte35AdBreak",
|
|
4597
|
+
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4598
|
+
if (!this.video.muted) {
|
|
4599
|
+
this.video.muted = true;
|
|
4600
|
+
this.video.volume = 0;
|
|
4601
|
+
if (this.config.debugAdTiming) {
|
|
4602
|
+
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
this.inAdBreak = true;
|
|
4606
|
+
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4607
|
+
this.scheduledScte35BreakKey = void 0;
|
|
4608
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4609
|
+
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4610
|
+
this.handleAdStart(marker);
|
|
4611
|
+
if (this.expectedAdBreakDurationMs != null) {
|
|
4612
|
+
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4613
|
+
}
|
|
4614
|
+
}
|
|
4615
|
+
},
|
|
4343
4616
|
{
|
|
4344
4617
|
key: "parseCueOutDuration",
|
|
4345
4618
|
value: function parseCueOutDuration(value) {
|
|
@@ -4423,6 +4696,336 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4423
4696
|
return false;
|
|
4424
4697
|
}
|
|
4425
4698
|
},
|
|
4699
|
+
{
|
|
4700
|
+
key: "normalizeFragmentPayload",
|
|
4701
|
+
value: function normalizeFragmentPayload(payload) {
|
|
4702
|
+
if (_instanceof(payload, Uint8Array)) {
|
|
4703
|
+
return payload;
|
|
4704
|
+
}
|
|
4705
|
+
if (_instanceof(payload, ArrayBuffer)) {
|
|
4706
|
+
return new Uint8Array(payload);
|
|
4707
|
+
}
|
|
4708
|
+
if (ArrayBuffer.isView(payload)) {
|
|
4709
|
+
var view = payload;
|
|
4710
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
4711
|
+
}
|
|
4712
|
+
return void 0;
|
|
4713
|
+
}
|
|
4714
|
+
},
|
|
4715
|
+
{
|
|
4716
|
+
key: "processFragmentScte35Payload",
|
|
4717
|
+
value: function processFragmentScte35Payload(payloadData, fragmentSn, fragmentStartSeconds) {
|
|
4718
|
+
var _this = this;
|
|
4719
|
+
var payload = this.normalizeFragmentPayload(payloadData);
|
|
4720
|
+
if (!payload) {
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
var markers = this.parseScte35FromTsPackets(payload);
|
|
4724
|
+
markers.forEach(function(marker) {
|
|
4725
|
+
var context = {
|
|
4726
|
+
source: "ts",
|
|
4727
|
+
readiness: "early"
|
|
4728
|
+
};
|
|
4729
|
+
if (fragmentSn !== void 0) {
|
|
4730
|
+
context.fragmentSn = fragmentSn;
|
|
4731
|
+
}
|
|
4732
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4733
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4734
|
+
}
|
|
4735
|
+
_this.onScte35Cue(marker, context);
|
|
4736
|
+
});
|
|
4737
|
+
}
|
|
4738
|
+
},
|
|
4739
|
+
{
|
|
4740
|
+
key: "parseScte35FromTsPackets",
|
|
4741
|
+
value: function parseScte35FromTsPackets(data) {
|
|
4742
|
+
var packetInfo = this.detectTsPacketFormat(data);
|
|
4743
|
+
if (!packetInfo) {
|
|
4744
|
+
return [];
|
|
4745
|
+
}
|
|
4746
|
+
var markers = [];
|
|
4747
|
+
var sectionAssemblers = /* @__PURE__ */ new Map();
|
|
4748
|
+
for(var packetStart = packetInfo.offset; packetStart + packetInfo.packetSize <= data.length; packetStart += packetInfo.packetSize){
|
|
4749
|
+
var tsStart = packetStart + packetInfo.tsPayloadOffset;
|
|
4750
|
+
if (data[tsStart] !== 71) {
|
|
4751
|
+
continue;
|
|
4752
|
+
}
|
|
4753
|
+
var secondByte = data[tsStart + 1];
|
|
4754
|
+
var thirdByte = data[tsStart + 2];
|
|
4755
|
+
var fourthByte = data[tsStart + 3];
|
|
4756
|
+
if (secondByte == null || thirdByte == null || fourthByte == null || (secondByte & 128) !== 0) {
|
|
4757
|
+
continue;
|
|
4758
|
+
}
|
|
4759
|
+
var payloadUnitStart = (secondByte & 64) !== 0;
|
|
4760
|
+
var pid = (secondByte & 31) << 8 | thirdByte;
|
|
4761
|
+
var adaptationFieldControl = fourthByte >> 4 & 3;
|
|
4762
|
+
var hasPayload = adaptationFieldControl === 1 || adaptationFieldControl === 3;
|
|
4763
|
+
if (!hasPayload) {
|
|
4764
|
+
continue;
|
|
4765
|
+
}
|
|
4766
|
+
var payloadStart = tsStart + 4;
|
|
4767
|
+
if (adaptationFieldControl === 3) {
|
|
4768
|
+
var adaptationLength = data[payloadStart];
|
|
4769
|
+
if (adaptationLength == null) {
|
|
4770
|
+
continue;
|
|
4771
|
+
}
|
|
4772
|
+
payloadStart += 1 + adaptationLength;
|
|
4773
|
+
}
|
|
4774
|
+
var payloadEnd = Math.min(tsStart + 188, data.length);
|
|
4775
|
+
if (payloadStart >= payloadEnd || payloadStart >= data.length) {
|
|
4776
|
+
continue;
|
|
4777
|
+
}
|
|
4778
|
+
var payload = data.subarray(payloadStart, payloadEnd);
|
|
4779
|
+
if (pid === 0) {
|
|
4780
|
+
this.parsePatSection(payload, payloadUnitStart);
|
|
4781
|
+
} else if (this.pmtPids.has(pid)) {
|
|
4782
|
+
this.parsePmtSection(payload, payloadUnitStart);
|
|
4783
|
+
} else if (this.tsScte35Pids.has(pid)) {
|
|
4784
|
+
this.collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, sectionAssemblers, markers);
|
|
4785
|
+
}
|
|
4786
|
+
}
|
|
4787
|
+
return markers;
|
|
4788
|
+
}
|
|
4789
|
+
},
|
|
4790
|
+
{
|
|
4791
|
+
key: "detectTsPacketFormat",
|
|
4792
|
+
value: function detectTsPacketFormat(data) {
|
|
4793
|
+
var packetSizes = [
|
|
4794
|
+
188,
|
|
4795
|
+
192,
|
|
4796
|
+
204
|
|
4797
|
+
];
|
|
4798
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4799
|
+
try {
|
|
4800
|
+
for(var _iterator = packetSizes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4801
|
+
var packetSize = _step.value;
|
|
4802
|
+
var tsPayloadOffset = packetSize === 192 ? 4 : 0;
|
|
4803
|
+
for(var offset = 0; offset < packetSize; offset++){
|
|
4804
|
+
var matchedPackets = 0;
|
|
4805
|
+
for(var packetStart = offset; packetStart + tsPayloadOffset < data.length && matchedPackets < 5; packetStart += packetSize){
|
|
4806
|
+
if (data[packetStart + tsPayloadOffset] !== 71) {
|
|
4807
|
+
break;
|
|
4808
|
+
}
|
|
4809
|
+
matchedPackets++;
|
|
4810
|
+
}
|
|
4811
|
+
if (matchedPackets >= 2) {
|
|
4812
|
+
return {
|
|
4813
|
+
offset: offset,
|
|
4814
|
+
packetSize: packetSize,
|
|
4815
|
+
tsPayloadOffset: tsPayloadOffset
|
|
4816
|
+
};
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
} catch (err) {
|
|
4821
|
+
_didIteratorError = true;
|
|
4822
|
+
_iteratorError = err;
|
|
4823
|
+
} finally{
|
|
4824
|
+
try {
|
|
4825
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4826
|
+
_iterator.return();
|
|
4827
|
+
}
|
|
4828
|
+
} finally{
|
|
4829
|
+
if (_didIteratorError) {
|
|
4830
|
+
throw _iteratorError;
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
}
|
|
4834
|
+
return void 0;
|
|
4835
|
+
}
|
|
4836
|
+
},
|
|
4837
|
+
{
|
|
4838
|
+
key: "parsePatSection",
|
|
4839
|
+
value: function parsePatSection(payload, payloadUnitStart) {
|
|
4840
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4841
|
+
if (sectionStart == null || sectionStart + 8 >= payload.length) {
|
|
4842
|
+
return;
|
|
4843
|
+
}
|
|
4844
|
+
if (payload[sectionStart] !== 0) {
|
|
4845
|
+
return;
|
|
4846
|
+
}
|
|
4847
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4848
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4849
|
+
for(var offset = sectionStart + 8; offset + 4 <= sectionEnd - 4; offset += 4){
|
|
4850
|
+
var _payload_offset, _payload_, _payload_1, _payload_2;
|
|
4851
|
+
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);
|
|
4852
|
+
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);
|
|
4853
|
+
if (programNumber !== 0) {
|
|
4854
|
+
this.pmtPids.add(pid);
|
|
4855
|
+
}
|
|
4856
|
+
}
|
|
4857
|
+
}
|
|
4858
|
+
},
|
|
4859
|
+
{
|
|
4860
|
+
key: "parsePmtSection",
|
|
4861
|
+
value: function parsePmtSection(payload, payloadUnitStart) {
|
|
4862
|
+
var _payload_, _payload_1;
|
|
4863
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4864
|
+
if (sectionStart == null || sectionStart + 12 >= payload.length) {
|
|
4865
|
+
return;
|
|
4866
|
+
}
|
|
4867
|
+
if (payload[sectionStart] !== 2) {
|
|
4868
|
+
return;
|
|
4869
|
+
}
|
|
4870
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4871
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4872
|
+
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);
|
|
4873
|
+
var offset = sectionStart + 12 + programInfoLength;
|
|
4874
|
+
while(offset + 5 <= sectionEnd - 4){
|
|
4875
|
+
var _payload_offset, _payload_2, _payload_3, _payload_4, _payload_5;
|
|
4876
|
+
var streamType = (_payload_offset = payload[offset]) !== null && _payload_offset !== void 0 ? _payload_offset : 0;
|
|
4877
|
+
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);
|
|
4878
|
+
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);
|
|
4879
|
+
var descriptorStart = offset + 5;
|
|
4880
|
+
var descriptorEnd = Math.min(descriptorStart + esInfoLength, sectionEnd - 4);
|
|
4881
|
+
if (streamType === 134 || streamType === 6 && this.descriptorsIdentifyScte35(payload, descriptorStart, descriptorEnd)) {
|
|
4882
|
+
this.tsScte35Pids.add(elementaryPid);
|
|
4883
|
+
}
|
|
4884
|
+
offset = descriptorStart + esInfoLength;
|
|
4885
|
+
}
|
|
4886
|
+
}
|
|
4887
|
+
},
|
|
4888
|
+
{
|
|
4889
|
+
key: "descriptorsIdentifyScte35",
|
|
4890
|
+
value: function descriptorsIdentifyScte35(data, start, end) {
|
|
4891
|
+
var offset = start;
|
|
4892
|
+
while(offset + 2 <= end){
|
|
4893
|
+
var _data_offset, _data_, _data_descriptorStart, _data_1, _data_2, _data_3;
|
|
4894
|
+
var tag = (_data_offset = data[offset]) !== null && _data_offset !== void 0 ? _data_offset : 0;
|
|
4895
|
+
var length = (_data_ = data[offset + 1]) !== null && _data_ !== void 0 ? _data_ : 0;
|
|
4896
|
+
var descriptorStart = offset + 2;
|
|
4897
|
+
var descriptorEnd = descriptorStart + length;
|
|
4898
|
+
if (descriptorEnd > end) {
|
|
4899
|
+
return false;
|
|
4900
|
+
}
|
|
4901
|
+
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) : "";
|
|
4902
|
+
if (tag === 138 || registration === "CUEI" || registration === "SCTE") {
|
|
4903
|
+
return true;
|
|
4904
|
+
}
|
|
4905
|
+
offset = descriptorEnd;
|
|
4906
|
+
}
|
|
4907
|
+
return false;
|
|
4908
|
+
}
|
|
4909
|
+
},
|
|
4910
|
+
{
|
|
4911
|
+
key: "collectScte35SectionsFromPayload",
|
|
4912
|
+
value: function collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, assemblers, markers) {
|
|
4913
|
+
if (payload.length === 0) {
|
|
4914
|
+
return;
|
|
4915
|
+
}
|
|
4916
|
+
var offset = 0;
|
|
4917
|
+
if (payloadUnitStart) {
|
|
4918
|
+
var _payload_;
|
|
4919
|
+
var pointerField = (_payload_ = payload[0]) !== null && _payload_ !== void 0 ? _payload_ : 0;
|
|
4920
|
+
var previousAssembler = assemblers.get(pid);
|
|
4921
|
+
if (previousAssembler && pointerField > 0) {
|
|
4922
|
+
this.appendScte35Bytes(pid, payload.subarray(1, Math.min(1 + pointerField, payload.length)), assemblers, markers);
|
|
4923
|
+
}
|
|
4924
|
+
assemblers.delete(pid);
|
|
4925
|
+
offset = 1 + pointerField;
|
|
4926
|
+
} else {
|
|
4927
|
+
this.appendScte35Bytes(pid, payload, assemblers, markers);
|
|
4928
|
+
return;
|
|
4929
|
+
}
|
|
4930
|
+
while(offset + 3 <= payload.length){
|
|
4931
|
+
var tableId = payload[offset];
|
|
4932
|
+
if (tableId == null || tableId === 255) {
|
|
4933
|
+
return;
|
|
4934
|
+
}
|
|
4935
|
+
var sectionLength = this.getPsiSectionLength(payload, offset);
|
|
4936
|
+
var totalLength = 3 + sectionLength;
|
|
4937
|
+
if (sectionLength <= 0 || totalLength <= 3) {
|
|
4938
|
+
return;
|
|
4939
|
+
}
|
|
4940
|
+
if (offset + totalLength <= payload.length) {
|
|
4941
|
+
this.addScte35SectionMarker(payload.subarray(offset, offset + totalLength), markers);
|
|
4942
|
+
offset += totalLength;
|
|
4943
|
+
} else {
|
|
4944
|
+
assemblers.set(pid, {
|
|
4945
|
+
bytes: Array.from(payload.subarray(offset)),
|
|
4946
|
+
expectedLength: totalLength
|
|
4947
|
+
});
|
|
4948
|
+
return;
|
|
4949
|
+
}
|
|
4950
|
+
}
|
|
4951
|
+
}
|
|
4952
|
+
},
|
|
4953
|
+
{
|
|
4954
|
+
key: "appendScte35Bytes",
|
|
4955
|
+
value: function appendScte35Bytes(pid, bytes, assemblers, markers) {
|
|
4956
|
+
var assembler = assemblers.get(pid);
|
|
4957
|
+
if (!assembler) {
|
|
4958
|
+
return;
|
|
4959
|
+
}
|
|
4960
|
+
for(var i = 0; i < bytes.length && assembler.bytes.length < assembler.expectedLength; i++){
|
|
4961
|
+
var _bytes_i;
|
|
4962
|
+
assembler.bytes.push((_bytes_i = bytes[i]) !== null && _bytes_i !== void 0 ? _bytes_i : 0);
|
|
4963
|
+
}
|
|
4964
|
+
if (assembler.bytes.length >= assembler.expectedLength) {
|
|
4965
|
+
assemblers.delete(pid);
|
|
4966
|
+
this.addScte35SectionMarker(new Uint8Array(assembler.bytes), markers);
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4969
|
+
},
|
|
4970
|
+
{
|
|
4971
|
+
key: "addScte35SectionMarker",
|
|
4972
|
+
value: function addScte35SectionMarker(section, markers) {
|
|
4973
|
+
if (section[0] !== 252 || this.hasProcessedTsScte35Section(section)) {
|
|
4974
|
+
return;
|
|
4975
|
+
}
|
|
4976
|
+
var marker = this.parseScte35Binary(section);
|
|
4977
|
+
if (!marker) {
|
|
4978
|
+
return;
|
|
4979
|
+
}
|
|
4980
|
+
marker.raw = _object_spread_props(_object_spread({}, _type_of(marker.raw) === "object" && marker.raw ? marker.raw : {}), {
|
|
4981
|
+
source: "ts-packet"
|
|
4982
|
+
});
|
|
4983
|
+
markers.push(marker);
|
|
4984
|
+
}
|
|
4985
|
+
},
|
|
4986
|
+
{
|
|
4987
|
+
key: "hasProcessedTsScte35Section",
|
|
4988
|
+
value: function hasProcessedTsScte35Section(section) {
|
|
4989
|
+
var checksum = 0;
|
|
4990
|
+
for(var i = 0; i < section.length; i++){
|
|
4991
|
+
var _section_i;
|
|
4992
|
+
checksum = checksum * 31 + ((_section_i = section[i]) !== null && _section_i !== void 0 ? _section_i : 0) >>> 0;
|
|
4993
|
+
}
|
|
4994
|
+
var key = "".concat(section.length, ":").concat(checksum);
|
|
4995
|
+
if (this.processedTsScte35Sections.has(key)) {
|
|
4996
|
+
return true;
|
|
4997
|
+
}
|
|
4998
|
+
this.processedTsScte35Sections.add(key);
|
|
4999
|
+
if (this.processedTsScte35Sections.size > 200) {
|
|
5000
|
+
var firstKey = this.processedTsScte35Sections.values().next().value;
|
|
5001
|
+
if (firstKey) {
|
|
5002
|
+
this.processedTsScte35Sections.delete(firstKey);
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
return false;
|
|
5006
|
+
}
|
|
5007
|
+
},
|
|
5008
|
+
{
|
|
5009
|
+
key: "getPsiSectionStart",
|
|
5010
|
+
value: function getPsiSectionStart(payload, payloadUnitStart) {
|
|
5011
|
+
if (!payloadUnitStart) {
|
|
5012
|
+
return void 0;
|
|
5013
|
+
}
|
|
5014
|
+
var pointerField = payload[0];
|
|
5015
|
+
if (pointerField == null) {
|
|
5016
|
+
return void 0;
|
|
5017
|
+
}
|
|
5018
|
+
var sectionStart = 1 + pointerField;
|
|
5019
|
+
return sectionStart < payload.length ? sectionStart : void 0;
|
|
5020
|
+
}
|
|
5021
|
+
},
|
|
5022
|
+
{
|
|
5023
|
+
key: "getPsiSectionLength",
|
|
5024
|
+
value: function getPsiSectionLength(data, offset) {
|
|
5025
|
+
var _data_, _data_1;
|
|
5026
|
+
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);
|
|
5027
|
+
}
|
|
5028
|
+
},
|
|
4426
5029
|
{
|
|
4427
5030
|
key: "parseScte35Binary",
|
|
4428
5031
|
value: function parseScte35Binary(data) {
|
|
@@ -4462,10 +5065,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4462
5065
|
value: function skipBits(n) {
|
|
4463
5066
|
this.readBits(n);
|
|
4464
5067
|
}
|
|
5068
|
+
},
|
|
5069
|
+
{
|
|
5070
|
+
key: "bytePosition",
|
|
5071
|
+
get: function get() {
|
|
5072
|
+
return this.bitPos === 0 ? this.bytePos : this.bytePos + 1;
|
|
5073
|
+
}
|
|
4465
5074
|
}
|
|
4466
5075
|
]);
|
|
4467
5076
|
return BitReader;
|
|
4468
5077
|
}();
|
|
5078
|
+
var readSpliceTime = function readSpliceTime(r2, ptsAdjustmentTicks2) {
|
|
5079
|
+
var timeSpecifiedFlag = r2.readBits(1) === 1;
|
|
5080
|
+
if (!timeSpecifiedFlag) {
|
|
5081
|
+
r2.readBits(7);
|
|
5082
|
+
return void 0;
|
|
5083
|
+
}
|
|
5084
|
+
r2.readBits(6);
|
|
5085
|
+
var high = r2.readBits(1);
|
|
5086
|
+
var low = r2.readBits(32);
|
|
5087
|
+
var ptsTicks = (high * 4294967296 + low + ptsAdjustmentTicks2) % 8589934592;
|
|
5088
|
+
return ptsTicks / 9e4;
|
|
5089
|
+
};
|
|
4469
5090
|
var r = new BitReader(data);
|
|
4470
5091
|
var tableId = r.readBits(8);
|
|
4471
5092
|
if (tableId !== 252) return void 0;
|
|
@@ -4473,77 +5094,206 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4473
5094
|
r.readBits(1);
|
|
4474
5095
|
r.readBits(2);
|
|
4475
5096
|
var sectionLength = r.readBits(12);
|
|
5097
|
+
if (sectionLength <= 0 || data.length < 3 + sectionLength) {
|
|
5098
|
+
return void 0;
|
|
5099
|
+
}
|
|
4476
5100
|
r.readBits(8);
|
|
4477
5101
|
r.readBits(1);
|
|
4478
5102
|
r.readBits(6);
|
|
4479
5103
|
var ptsAdjHigh = r.readBits(1);
|
|
4480
5104
|
var ptsAdjLow = r.readBits(32);
|
|
4481
|
-
|
|
4482
|
-
void ptsAdjLow;
|
|
5105
|
+
var ptsAdjustmentTicks = ptsAdjHigh * 4294967296 + ptsAdjLow;
|
|
4483
5106
|
r.readBits(8);
|
|
4484
5107
|
r.readBits(12);
|
|
4485
5108
|
var spliceCommandLength = r.readBits(12);
|
|
4486
5109
|
var spliceCommandType = r.readBits(8);
|
|
4487
|
-
|
|
5110
|
+
var markerType;
|
|
5111
|
+
var durationSeconds = void 0;
|
|
5112
|
+
var ptsSeconds = void 0;
|
|
5113
|
+
var spliceEventId = void 0;
|
|
5114
|
+
var commandBodyStart = r.bytePosition;
|
|
5115
|
+
if (spliceCommandType === 5) {
|
|
5116
|
+
spliceEventId = r.readBits(32);
|
|
5117
|
+
var cancel = r.readBits(1) === 1;
|
|
5118
|
+
r.readBits(7);
|
|
5119
|
+
if (cancel) return void 0;
|
|
5120
|
+
var outOfNetwork = r.readBits(1) === 1;
|
|
5121
|
+
var programSpliceFlag = r.readBits(1) === 1;
|
|
5122
|
+
var durationFlag = r.readBits(1) === 1;
|
|
5123
|
+
var spliceImmediateFlag = r.readBits(1) === 1;
|
|
5124
|
+
r.readBits(4);
|
|
5125
|
+
markerType = outOfNetwork ? "start" : "end";
|
|
5126
|
+
if (programSpliceFlag && !spliceImmediateFlag) {
|
|
5127
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5128
|
+
} else if (!programSpliceFlag) {
|
|
5129
|
+
var componentCount = r.readBits(8);
|
|
5130
|
+
for(var i = 0; i < componentCount; i++){
|
|
5131
|
+
r.readBits(8);
|
|
5132
|
+
if (!spliceImmediateFlag) {
|
|
5133
|
+
var componentPtsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5134
|
+
if (ptsSeconds === void 0) {
|
|
5135
|
+
ptsSeconds = componentPtsSeconds;
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5138
|
+
}
|
|
5139
|
+
}
|
|
5140
|
+
if (durationFlag) {
|
|
5141
|
+
r.readBits(6);
|
|
5142
|
+
r.readBits(1);
|
|
5143
|
+
var high = r.readBits(1);
|
|
5144
|
+
var low = r.readBits(32);
|
|
5145
|
+
var durationTicks = high * 4294967296 + low;
|
|
5146
|
+
durationSeconds = durationTicks / 9e4;
|
|
5147
|
+
}
|
|
5148
|
+
r.readBits(16);
|
|
5149
|
+
r.readBits(8);
|
|
5150
|
+
r.readBits(8);
|
|
5151
|
+
} else if (spliceCommandType === 6) {
|
|
5152
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5153
|
+
} else {
|
|
4488
5154
|
return void 0;
|
|
4489
5155
|
}
|
|
4490
|
-
r.
|
|
4491
|
-
var
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
}
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
5156
|
+
var expectedDescriptorOffset = spliceCommandLength === 4095 ? r.bytePosition : commandBodyStart + spliceCommandLength;
|
|
5157
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptors(data, expectedDescriptorOffset);
|
|
5158
|
+
if (descriptorMarker) {
|
|
5159
|
+
markerType = descriptorMarker.type;
|
|
5160
|
+
if (durationSeconds === void 0) {
|
|
5161
|
+
durationSeconds = descriptorMarker.durationSeconds;
|
|
5162
|
+
}
|
|
5163
|
+
}
|
|
5164
|
+
if (!markerType) {
|
|
5165
|
+
return void 0;
|
|
5166
|
+
}
|
|
5167
|
+
var marker = _object_spread_props(_object_spread({
|
|
5168
|
+
type: markerType
|
|
5169
|
+
}, ptsSeconds !== void 0 ? {
|
|
5170
|
+
ptsSeconds: ptsSeconds
|
|
5171
|
+
} : {}, durationSeconds !== void 0 ? {
|
|
5172
|
+
durationSeconds: durationSeconds
|
|
5173
|
+
} : {}), {
|
|
5174
|
+
raw: _object_spread({
|
|
5175
|
+
splice_command_type: spliceCommandType
|
|
5176
|
+
}, spliceEventId !== void 0 ? {
|
|
5177
|
+
splice_event_id: spliceEventId
|
|
5178
|
+
} : {}, (descriptorMarker === null || descriptorMarker === void 0 ? void 0 : descriptorMarker.segmentationEventId) !== void 0 ? {
|
|
5179
|
+
segmentation_event_id: descriptorMarker.segmentationEventId
|
|
5180
|
+
} : {})
|
|
5181
|
+
});
|
|
5182
|
+
return marker;
|
|
5183
|
+
}
|
|
5184
|
+
},
|
|
5185
|
+
{
|
|
5186
|
+
key: "parseScte35SegmentationDescriptors",
|
|
5187
|
+
value: function parseScte35SegmentationDescriptors(data, offset) {
|
|
5188
|
+
var _data_offset, _data_;
|
|
5189
|
+
if (offset + 2 > data.length) {
|
|
5190
|
+
return void 0;
|
|
5191
|
+
}
|
|
5192
|
+
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);
|
|
5193
|
+
var descriptorOffset = offset + 2;
|
|
5194
|
+
var descriptorEnd = Math.min(data.length, descriptorOffset + descriptorLoopLength);
|
|
5195
|
+
while(descriptorOffset + 2 <= descriptorEnd){
|
|
5196
|
+
var _data_descriptorOffset, _data_1;
|
|
5197
|
+
var descriptorTag = (_data_descriptorOffset = data[descriptorOffset]) !== null && _data_descriptorOffset !== void 0 ? _data_descriptorOffset : 0;
|
|
5198
|
+
var descriptorLength = (_data_1 = data[descriptorOffset + 1]) !== null && _data_1 !== void 0 ? _data_1 : 0;
|
|
5199
|
+
var descriptorDataStart = descriptorOffset + 2;
|
|
5200
|
+
var descriptorDataEnd = descriptorDataStart + descriptorLength;
|
|
5201
|
+
if (descriptorDataEnd > descriptorEnd) {
|
|
5202
|
+
return void 0;
|
|
5203
|
+
}
|
|
5204
|
+
if (descriptorTag === 2) {
|
|
5205
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptor(data.subarray(descriptorDataStart, descriptorDataEnd));
|
|
5206
|
+
if (descriptorMarker) {
|
|
5207
|
+
return descriptorMarker;
|
|
4519
5208
|
}
|
|
4520
5209
|
}
|
|
5210
|
+
descriptorOffset = descriptorDataEnd;
|
|
5211
|
+
}
|
|
5212
|
+
return void 0;
|
|
5213
|
+
}
|
|
5214
|
+
},
|
|
5215
|
+
{
|
|
5216
|
+
key: "parseScte35SegmentationDescriptor",
|
|
5217
|
+
value: function parseScte35SegmentationDescriptor(descriptor) {
|
|
5218
|
+
var _descriptor_, _descriptor_1, _descriptor_2, _descriptor_3, _descriptor_4, _descriptor_5, _descriptor_6, _descriptor_7, _descriptor_8, _descriptor_9, _descriptor_offset, _descriptor_offset1;
|
|
5219
|
+
if (descriptor.length < 11) {
|
|
5220
|
+
return void 0;
|
|
5221
|
+
}
|
|
5222
|
+
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);
|
|
5223
|
+
if (identifier !== "CUEI") {
|
|
5224
|
+
return void 0;
|
|
5225
|
+
}
|
|
5226
|
+
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);
|
|
5227
|
+
var cancelIndicator = (((_descriptor_8 = descriptor[8]) !== null && _descriptor_8 !== void 0 ? _descriptor_8 : 0) & 128) !== 0;
|
|
5228
|
+
if (cancelIndicator) {
|
|
5229
|
+
return void 0;
|
|
5230
|
+
}
|
|
5231
|
+
var flags = (_descriptor_9 = descriptor[9]) !== null && _descriptor_9 !== void 0 ? _descriptor_9 : 0;
|
|
5232
|
+
var programSegmentationFlag = (flags & 128) !== 0;
|
|
5233
|
+
var segmentationDurationFlag = (flags & 64) !== 0;
|
|
5234
|
+
var offset = 10;
|
|
5235
|
+
if (!programSegmentationFlag) {
|
|
5236
|
+
var _descriptor_offset2;
|
|
5237
|
+
var componentCount = (_descriptor_offset2 = descriptor[offset]) !== null && _descriptor_offset2 !== void 0 ? _descriptor_offset2 : 0;
|
|
5238
|
+
offset += 1 + componentCount * 6;
|
|
5239
|
+
if (offset > descriptor.length) {
|
|
5240
|
+
return void 0;
|
|
5241
|
+
}
|
|
4521
5242
|
}
|
|
4522
5243
|
var durationSeconds = void 0;
|
|
4523
|
-
if (
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
var durationTicks =
|
|
5244
|
+
if (segmentationDurationFlag) {
|
|
5245
|
+
var _descriptor_offset3, _descriptor_10, _descriptor_11, _descriptor_12, _descriptor_13;
|
|
5246
|
+
if (offset + 5 > descriptor.length) {
|
|
5247
|
+
return void 0;
|
|
5248
|
+
}
|
|
5249
|
+
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);
|
|
4529
5250
|
durationSeconds = durationTicks / 9e4;
|
|
5251
|
+
offset += 5;
|
|
4530
5252
|
}
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
5253
|
+
if (offset + 2 > descriptor.length) {
|
|
5254
|
+
return void 0;
|
|
5255
|
+
}
|
|
5256
|
+
offset += 1;
|
|
5257
|
+
var segmentationUpidLength = (_descriptor_offset = descriptor[offset]) !== null && _descriptor_offset !== void 0 ? _descriptor_offset : 0;
|
|
5258
|
+
offset += 1 + segmentationUpidLength;
|
|
5259
|
+
if (offset >= descriptor.length) {
|
|
5260
|
+
return void 0;
|
|
5261
|
+
}
|
|
5262
|
+
var segmentationTypeId = (_descriptor_offset1 = descriptor[offset]) !== null && _descriptor_offset1 !== void 0 ? _descriptor_offset1 : 0;
|
|
5263
|
+
var markerType = this.markerTypeFromSegmentationTypeId(segmentationTypeId);
|
|
5264
|
+
if (!markerType) {
|
|
5265
|
+
return void 0;
|
|
5266
|
+
}
|
|
5267
|
+
return _object_spread_props(_object_spread({
|
|
5268
|
+
type: markerType
|
|
5269
|
+
}, durationSeconds !== void 0 ? {
|
|
5270
|
+
durationSeconds: durationSeconds
|
|
5271
|
+
} : {}), {
|
|
5272
|
+
segmentationEventId: segmentationEventId
|
|
5273
|
+
});
|
|
5274
|
+
}
|
|
5275
|
+
},
|
|
5276
|
+
{
|
|
5277
|
+
key: "markerTypeFromSegmentationTypeId",
|
|
5278
|
+
value: function markerTypeFromSegmentationTypeId(segmentationTypeId) {
|
|
5279
|
+
switch(segmentationTypeId){
|
|
5280
|
+
case 16:
|
|
5281
|
+
case 34:
|
|
5282
|
+
case 48:
|
|
5283
|
+
case 50:
|
|
5284
|
+
case 52:
|
|
5285
|
+
case 54:
|
|
5286
|
+
return "start";
|
|
5287
|
+
case 17:
|
|
5288
|
+
case 35:
|
|
5289
|
+
case 49:
|
|
5290
|
+
case 51:
|
|
5291
|
+
case 53:
|
|
5292
|
+
case 55:
|
|
5293
|
+
return "end";
|
|
5294
|
+
default:
|
|
5295
|
+
return void 0;
|
|
4545
5296
|
}
|
|
4546
|
-
return void 0;
|
|
4547
5297
|
}
|
|
4548
5298
|
},
|
|
4549
5299
|
{
|
|
@@ -4940,7 +5690,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4940
5690
|
},
|
|
4941
5691
|
{
|
|
4942
5692
|
key: "startAdPrefetch",
|
|
4943
|
-
value: function startAdPrefetch(marker, fragmentSn) {
|
|
5693
|
+
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
4944
5694
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
4945
5695
|
return;
|
|
4946
5696
|
}
|
|
@@ -4968,6 +5718,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4968
5718
|
isFetching: false,
|
|
4969
5719
|
fetchStartTime: Date.now()
|
|
4970
5720
|
});
|
|
5721
|
+
this.pendingScte35CueKey = cueKey;
|
|
4971
5722
|
this.adDetectSentForCurrentBreak = true;
|
|
4972
5723
|
var detectPayload = {};
|
|
4973
5724
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
@@ -4989,6 +5740,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4989
5740
|
this.prefetchTimerId = void 0;
|
|
4990
5741
|
}
|
|
4991
5742
|
this.pendingAdBreak = null;
|
|
5743
|
+
this.pendingScte35CueKey = void 0;
|
|
4992
5744
|
}
|
|
4993
5745
|
},
|
|
4994
5746
|
{
|
|
@@ -6472,18 +7224,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6472
7224
|
key: "scheduleAdStartIn",
|
|
6473
7225
|
value: function scheduleAdStartIn(delayMs) {
|
|
6474
7226
|
var _this = this;
|
|
7227
|
+
var marker = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7228
|
+
type: "start"
|
|
7229
|
+
}, cueKey = arguments.length > 2 ? arguments[2] : void 0;
|
|
6475
7230
|
this.clearAdStartTimer();
|
|
6476
7231
|
var ms = Math.max(0, Math.floor(delayMs));
|
|
6477
7232
|
if (ms === 0) {
|
|
6478
|
-
this.
|
|
6479
|
-
type: "start"
|
|
6480
|
-
}).catch(function() {});
|
|
7233
|
+
this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0);
|
|
6481
7234
|
return;
|
|
6482
7235
|
}
|
|
6483
7236
|
this.adStartTimerId = window.setTimeout(function() {
|
|
6484
|
-
_this.
|
|
6485
|
-
type: "start"
|
|
6486
|
-
}).catch(function() {});
|
|
7237
|
+
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.expectedAdBreakDurationMs);
|
|
6487
7238
|
}, ms);
|
|
6488
7239
|
}
|
|
6489
7240
|
},
|
|
@@ -6914,6 +7665,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6914
7665
|
this.adRequestQueue = [];
|
|
6915
7666
|
this.inAdBreak = false;
|
|
6916
7667
|
this.adDetectSentForCurrentBreak = false;
|
|
7668
|
+
this.activeScte35BreakKey = void 0;
|
|
7669
|
+
this.scheduledScte35BreakKey = void 0;
|
|
6917
7670
|
this.expectedAdBreakDurationMs = void 0;
|
|
6918
7671
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
6919
7672
|
this.clearAdStartTimer();
|