stormcloud-video-player 0.3.58 → 0.3.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +841 -88
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +40 -0
- package/lib/index.d.ts +40 -0
- package/lib/index.js +841 -88
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +841 -88
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +40 -0
- package/lib/players/HlsPlayer.cjs +841 -88
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +841 -88
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +841 -88
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -3224,6 +3224,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3224
3224
|
this.adRequestQueue = [];
|
|
3225
3225
|
this.maxPlaceholderDurationMs = 5e3;
|
|
3226
3226
|
this.isShowingPlaceholder = false;
|
|
3227
|
+
this.tsScte35Pids = /* @__PURE__ */ new Set();
|
|
3228
|
+
this.pmtPids = /* @__PURE__ */ new Set();
|
|
3229
|
+
this.processedTsScte35Sections = /* @__PURE__ */ new Set();
|
|
3230
|
+
this.pendingScte35Cues = /* @__PURE__ */ new Map();
|
|
3231
|
+
this.recentScte35CueKeys = /* @__PURE__ */ new Map();
|
|
3232
|
+
this.recentScte35CueLimit = 200;
|
|
3227
3233
|
this.totalAdRequestsInBreak = 0;
|
|
3228
3234
|
this.maxTotalAdRequestsPerBreak = 10;
|
|
3229
3235
|
this.pendingAdBreak = null;
|
|
@@ -3493,7 +3499,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3493
3499
|
if (_this.config.debugAdTiming) {
|
|
3494
3500
|
console.log("[StormcloudVideoPlayer] \uD83C\uDFAF EARLY SCTE-35 DETECTION: Ad break marker found in fragment", i, "- starting pre-fetch (NOT playing yet)");
|
|
3495
3501
|
}
|
|
3496
|
-
_this.
|
|
3502
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "early", frag)));
|
|
3497
3503
|
return;
|
|
3498
3504
|
}
|
|
3499
3505
|
}
|
|
@@ -3574,10 +3580,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3574
3580
|
return _this.onId3Tag(tag);
|
|
3575
3581
|
});
|
|
3576
3582
|
});
|
|
3583
|
+
this.hls.on(import_hls2.default.Events.FRAG_LOADED, function(_evt, data) {
|
|
3584
|
+
var _data_frag;
|
|
3585
|
+
_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));
|
|
3586
|
+
});
|
|
3587
|
+
this.hls.on(import_hls2.default.Events.FRAG_DECRYPTED, function(_evt, data) {
|
|
3588
|
+
var _data_frag;
|
|
3589
|
+
_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));
|
|
3590
|
+
});
|
|
3577
3591
|
this.hls.on(import_hls2.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3578
3592
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3579
3593
|
var tagList = frag === null || frag === void 0 ? void 0 : frag.tagList;
|
|
3580
|
-
if (!Array.isArray(tagList))
|
|
3594
|
+
if (!Array.isArray(tagList)) {
|
|
3595
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3596
|
+
return;
|
|
3597
|
+
}
|
|
3581
3598
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3582
3599
|
try {
|
|
3583
3600
|
for(var _iterator = tagList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -3613,7 +3630,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3613
3630
|
value: value
|
|
3614
3631
|
}
|
|
3615
3632
|
});
|
|
3616
|
-
_this.
|
|
3633
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3617
3634
|
} else if (tag.includes("EXT-X-CUE-OUT")) {
|
|
3618
3635
|
var durationSeconds = _this.parseCueOutDuration(value);
|
|
3619
3636
|
var marker1 = _object_spread_props(_object_spread({
|
|
@@ -3626,15 +3643,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3626
3643
|
value: value
|
|
3627
3644
|
}
|
|
3628
3645
|
});
|
|
3629
|
-
_this.
|
|
3646
|
+
_this.onScte35Cue(marker1, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3630
3647
|
} else if (tag.includes("EXT-X-CUE-IN")) {
|
|
3631
|
-
_this.
|
|
3648
|
+
_this.onScte35Cue({
|
|
3632
3649
|
type: "end",
|
|
3633
3650
|
raw: {
|
|
3634
3651
|
tag: tag,
|
|
3635
3652
|
value: value
|
|
3636
3653
|
}
|
|
3637
|
-
});
|
|
3654
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3638
3655
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
3639
3656
|
var _attrs_CLASS;
|
|
3640
3657
|
var attrs = _this.parseAttributeList(value);
|
|
@@ -3654,17 +3671,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3654
3671
|
attrs: attrs
|
|
3655
3672
|
}
|
|
3656
3673
|
});
|
|
3657
|
-
_this.
|
|
3674
|
+
_this.onScte35Cue(marker2, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3658
3675
|
}
|
|
3659
3676
|
if (hasScteIn) {
|
|
3660
|
-
_this.
|
|
3677
|
+
_this.onScte35Cue({
|
|
3661
3678
|
type: "end",
|
|
3662
3679
|
raw: {
|
|
3663
3680
|
tag: tag,
|
|
3664
3681
|
value: value,
|
|
3665
3682
|
attrs: attrs
|
|
3666
3683
|
}
|
|
3667
|
-
});
|
|
3684
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3668
3685
|
}
|
|
3669
3686
|
}
|
|
3670
3687
|
}
|
|
@@ -3682,6 +3699,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3682
3699
|
}
|
|
3683
3700
|
}
|
|
3684
3701
|
}
|
|
3702
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3685
3703
|
});
|
|
3686
3704
|
this.hls.on(import_hls2.default.Events.ERROR, function(_evt, data) {
|
|
3687
3705
|
if (data === null || data === void 0 ? void 0 : data.fatal) {
|
|
@@ -3987,7 +4005,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3987
4005
|
}
|
|
3988
4006
|
var marker = this.parseScte35FromId3(tag);
|
|
3989
4007
|
if (marker) {
|
|
3990
|
-
this.
|
|
4008
|
+
this.onScte35Cue(marker, {
|
|
4009
|
+
source: "id3",
|
|
4010
|
+
readiness: "playback"
|
|
4011
|
+
});
|
|
3991
4012
|
}
|
|
3992
4013
|
}
|
|
3993
4014
|
},
|
|
@@ -4131,9 +4152,251 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4131
4152
|
}
|
|
4132
4153
|
}
|
|
4133
4154
|
},
|
|
4155
|
+
{
|
|
4156
|
+
key: "createScte35CueContext",
|
|
4157
|
+
value: function createScte35CueContext(source, readiness, frag) {
|
|
4158
|
+
var context = {
|
|
4159
|
+
source: source,
|
|
4160
|
+
readiness: readiness
|
|
4161
|
+
};
|
|
4162
|
+
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
4163
|
+
context.fragmentSn = frag.sn;
|
|
4164
|
+
}
|
|
4165
|
+
var fragmentStartSeconds = this.getFragmentStartSeconds(frag);
|
|
4166
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4167
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4168
|
+
}
|
|
4169
|
+
return context;
|
|
4170
|
+
}
|
|
4171
|
+
},
|
|
4172
|
+
{
|
|
4173
|
+
key: "getFragmentStartSeconds",
|
|
4174
|
+
value: function getFragmentStartSeconds(frag) {
|
|
4175
|
+
var candidates = [
|
|
4176
|
+
frag === null || frag === void 0 ? void 0 : frag.start,
|
|
4177
|
+
frag === null || frag === void 0 ? void 0 : frag.startPTS
|
|
4178
|
+
];
|
|
4179
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4180
|
+
try {
|
|
4181
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4182
|
+
var candidate = _step.value;
|
|
4183
|
+
if (typeof candidate === "number" && Number.isFinite(candidate)) {
|
|
4184
|
+
return candidate;
|
|
4185
|
+
}
|
|
4186
|
+
}
|
|
4187
|
+
} catch (err) {
|
|
4188
|
+
_didIteratorError = true;
|
|
4189
|
+
_iteratorError = err;
|
|
4190
|
+
} finally{
|
|
4191
|
+
try {
|
|
4192
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4193
|
+
_iterator.return();
|
|
4194
|
+
}
|
|
4195
|
+
} finally{
|
|
4196
|
+
if (_didIteratorError) {
|
|
4197
|
+
throw _iteratorError;
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
return void 0;
|
|
4202
|
+
}
|
|
4203
|
+
},
|
|
4204
|
+
{
|
|
4205
|
+
key: "onScte35Cue",
|
|
4206
|
+
value: function onScte35Cue(marker, context) {
|
|
4207
|
+
var cue = this.createScte35Cue(marker, context);
|
|
4208
|
+
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
4209
|
+
if (context.readiness === "early") {
|
|
4210
|
+
this.pendingScte35Cues.set(pendingKey, cue);
|
|
4211
|
+
this.trimRecentScte35CueMaps();
|
|
4212
|
+
if (marker.type === "start") {
|
|
4213
|
+
this.startAdPrefetch(marker, context.fragmentSn, cue.key);
|
|
4214
|
+
}
|
|
4215
|
+
return;
|
|
4216
|
+
}
|
|
4217
|
+
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
4218
|
+
if (this.config.debugAdTiming) {
|
|
4219
|
+
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
4220
|
+
key: cue.key,
|
|
4221
|
+
activeScte35BreakKey: this.activeScte35BreakKey,
|
|
4222
|
+
inAdBreak: this.inAdBreak,
|
|
4223
|
+
source: cue.source
|
|
4224
|
+
});
|
|
4225
|
+
}
|
|
4226
|
+
return;
|
|
4227
|
+
}
|
|
4228
|
+
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
4229
|
+
if (this.config.debugAdTiming) {
|
|
4230
|
+
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
4231
|
+
key: cue.key,
|
|
4232
|
+
source: cue.source
|
|
4233
|
+
});
|
|
4234
|
+
}
|
|
4235
|
+
return;
|
|
4236
|
+
}
|
|
4237
|
+
this.pendingScte35Cues.delete(pendingKey);
|
|
4238
|
+
this.markScte35CueHandled(cue);
|
|
4239
|
+
this.onScte35Marker(marker, cue.key);
|
|
4240
|
+
}
|
|
4241
|
+
},
|
|
4242
|
+
{
|
|
4243
|
+
key: "createScte35Cue",
|
|
4244
|
+
value: function createScte35Cue(marker, context) {
|
|
4245
|
+
var cue = {
|
|
4246
|
+
marker: marker,
|
|
4247
|
+
source: context.source,
|
|
4248
|
+
readiness: context.readiness,
|
|
4249
|
+
key: this.getScte35CueKey(marker, context)
|
|
4250
|
+
};
|
|
4251
|
+
if (context.fragmentSn !== void 0) {
|
|
4252
|
+
cue.fragmentSn = context.fragmentSn;
|
|
4253
|
+
}
|
|
4254
|
+
if (context.fragmentStartSeconds !== void 0) {
|
|
4255
|
+
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
4256
|
+
}
|
|
4257
|
+
return cue;
|
|
4258
|
+
}
|
|
4259
|
+
},
|
|
4260
|
+
{
|
|
4261
|
+
key: "getScte35CueKey",
|
|
4262
|
+
value: function getScte35CueKey(marker, context) {
|
|
4263
|
+
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
4264
|
+
var raw = this.getScte35MarkerRaw(marker);
|
|
4265
|
+
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
4266
|
+
if (spliceEventId) {
|
|
4267
|
+
return "splice:".concat(spliceEventId);
|
|
4268
|
+
}
|
|
4269
|
+
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
4270
|
+
if (segmentationEventId) {
|
|
4271
|
+
return "segmentation:".concat(segmentationEventId);
|
|
4272
|
+
}
|
|
4273
|
+
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);
|
|
4274
|
+
if (daterangeId) {
|
|
4275
|
+
return "daterange:".concat(daterangeId);
|
|
4276
|
+
}
|
|
4277
|
+
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"]);
|
|
4278
|
+
if (scteValue) {
|
|
4279
|
+
return "daterange-scte:".concat(scteValue);
|
|
4280
|
+
}
|
|
4281
|
+
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
4282
|
+
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
4283
|
+
}
|
|
4284
|
+
if (context.fragmentSn !== void 0) {
|
|
4285
|
+
return "fragment:".concat(context.fragmentSn);
|
|
4286
|
+
}
|
|
4287
|
+
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4288
|
+
}
|
|
4289
|
+
},
|
|
4290
|
+
{
|
|
4291
|
+
key: "getPendingScte35CueKey",
|
|
4292
|
+
value: function getPendingScte35CueKey(cue) {
|
|
4293
|
+
return "".concat(cue.marker.type, ":").concat(cue.key, ":").concat(cue.fragmentSn !== void 0 ? cue.fragmentSn : "unknown");
|
|
4294
|
+
}
|
|
4295
|
+
},
|
|
4296
|
+
{
|
|
4297
|
+
key: "getScte35MarkerRaw",
|
|
4298
|
+
value: function getScte35MarkerRaw(marker) {
|
|
4299
|
+
return _type_of(marker.raw) === "object" && marker.raw !== null ? marker.raw : {};
|
|
4300
|
+
}
|
|
4301
|
+
},
|
|
4302
|
+
{
|
|
4303
|
+
key: "toIdentityString",
|
|
4304
|
+
value: function toIdentityString(value) {
|
|
4305
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4306
|
+
return String(value);
|
|
4307
|
+
}
|
|
4308
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
4309
|
+
return value.trim();
|
|
4310
|
+
}
|
|
4311
|
+
return void 0;
|
|
4312
|
+
}
|
|
4313
|
+
},
|
|
4314
|
+
{
|
|
4315
|
+
key: "isStrongScte35CueKey",
|
|
4316
|
+
value: function isStrongScte35CueKey(key) {
|
|
4317
|
+
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4318
|
+
}
|
|
4319
|
+
},
|
|
4320
|
+
{
|
|
4321
|
+
key: "hasRecentlyHandledScte35Cue",
|
|
4322
|
+
value: function hasRecentlyHandledScte35Cue(cue) {
|
|
4323
|
+
if (this.activeScte35BreakKey === cue.key || this.scheduledScte35BreakKey === cue.key) {
|
|
4324
|
+
return true;
|
|
4325
|
+
}
|
|
4326
|
+
var recentKey = "".concat(cue.marker.type, ":").concat(cue.key);
|
|
4327
|
+
return this.recentScte35CueKeys.has(recentKey);
|
|
4328
|
+
}
|
|
4329
|
+
},
|
|
4330
|
+
{
|
|
4331
|
+
key: "markScte35CueHandled",
|
|
4332
|
+
value: function markScte35CueHandled(cue) {
|
|
4333
|
+
this.recentScte35CueKeys.set("".concat(cue.marker.type, ":").concat(cue.key), Date.now());
|
|
4334
|
+
this.trimRecentScte35CueMaps();
|
|
4335
|
+
}
|
|
4336
|
+
},
|
|
4337
|
+
{
|
|
4338
|
+
key: "trimRecentScte35CueMaps",
|
|
4339
|
+
value: function trimRecentScte35CueMaps() {
|
|
4340
|
+
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
4341
|
+
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
4342
|
+
if (!firstKey) {
|
|
4343
|
+
break;
|
|
4344
|
+
}
|
|
4345
|
+
this.recentScte35CueKeys.delete(firstKey);
|
|
4346
|
+
}
|
|
4347
|
+
while(this.pendingScte35Cues.size > this.recentScte35CueLimit){
|
|
4348
|
+
var firstKey1 = this.pendingScte35Cues.keys().next().value;
|
|
4349
|
+
if (!firstKey1) {
|
|
4350
|
+
break;
|
|
4351
|
+
}
|
|
4352
|
+
this.pendingScte35Cues.delete(firstKey1);
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4355
|
+
},
|
|
4356
|
+
{
|
|
4357
|
+
key: "shouldAcceptScte35EndCue",
|
|
4358
|
+
value: function shouldAcceptScte35EndCue(cue) {
|
|
4359
|
+
if (!this.inAdBreak) {
|
|
4360
|
+
return false;
|
|
4361
|
+
}
|
|
4362
|
+
if (this.isStrongScte35CueKey(this.activeScte35BreakKey) && this.isStrongScte35CueKey(cue.key) && this.activeScte35BreakKey !== cue.key) {
|
|
4363
|
+
return false;
|
|
4364
|
+
}
|
|
4365
|
+
return true;
|
|
4366
|
+
}
|
|
4367
|
+
},
|
|
4368
|
+
{
|
|
4369
|
+
key: "activatePendingScte35CuesForFragment",
|
|
4370
|
+
value: function activatePendingScte35CuesForFragment(frag) {
|
|
4371
|
+
var _this = this;
|
|
4372
|
+
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
4373
|
+
if (fragmentSn === void 0) {
|
|
4374
|
+
return;
|
|
4375
|
+
}
|
|
4376
|
+
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
4377
|
+
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
4378
|
+
return cue.fragmentSn === fragmentSn;
|
|
4379
|
+
});
|
|
4380
|
+
matchingCues.forEach(function(param) {
|
|
4381
|
+
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
4382
|
+
var _cue_fragmentStartSeconds;
|
|
4383
|
+
_this.pendingScte35Cues.delete(pendingKey);
|
|
4384
|
+
var context = {
|
|
4385
|
+
source: cue.source,
|
|
4386
|
+
readiness: "playback"
|
|
4387
|
+
};
|
|
4388
|
+
context.fragmentSn = fragmentSn;
|
|
4389
|
+
var fragmentStartSeconds = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : _this.getFragmentStartSeconds(frag);
|
|
4390
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4391
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4392
|
+
}
|
|
4393
|
+
_this.onScte35Cue(cue.marker, context);
|
|
4394
|
+
});
|
|
4395
|
+
}
|
|
4396
|
+
},
|
|
4134
4397
|
{
|
|
4135
4398
|
key: "onScte35Marker",
|
|
4136
|
-
value: function onScte35Marker(marker) {
|
|
4399
|
+
value: function onScte35Marker(marker, cueKey) {
|
|
4137
4400
|
if (this.config.debugAdTiming) {
|
|
4138
4401
|
console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
|
|
4139
4402
|
type: marker.type,
|
|
@@ -4147,13 +4410,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4147
4410
|
if (marker.type === "start") {
|
|
4148
4411
|
var _this_config_immediateManifestAds;
|
|
4149
4412
|
var _this_pendingAdBreak;
|
|
4150
|
-
if (!this.video.muted) {
|
|
4151
|
-
this.video.muted = true;
|
|
4152
|
-
this.video.volume = 0;
|
|
4153
|
-
if (this.config.debugAdTiming) {
|
|
4154
|
-
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4155
|
-
}
|
|
4156
|
-
}
|
|
4157
4413
|
if (this.inAdBreak) {
|
|
4158
4414
|
if (marker.durationSeconds != null) {
|
|
4159
4415
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
@@ -4177,10 +4433,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4177
4433
|
sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
|
|
4178
4434
|
}
|
|
4179
4435
|
var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
|
|
4180
|
-
this.inAdBreak = true;
|
|
4181
4436
|
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;
|
|
4182
|
-
this.expectedAdBreakDurationMs = durationMs;
|
|
4183
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4184
4437
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
4185
4438
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
4186
4439
|
if (this.config.debugAdTiming) {
|
|
@@ -4196,7 +4449,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4196
4449
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (manifest-based)".concat(hasPrefetchedAds ? " with prefetched ads" : ""));
|
|
4197
4450
|
}
|
|
4198
4451
|
this.clearAdStartTimer();
|
|
4199
|
-
this.
|
|
4452
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4200
4453
|
} else if (typeof marker.ptsSeconds === "number") {
|
|
4201
4454
|
var _this_config_driftToleranceMs;
|
|
4202
4455
|
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
@@ -4216,23 +4469,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4216
4469
|
if (this.config.debugAdTiming) {
|
|
4217
4470
|
console.log("[StormcloudVideoPlayer] Scheduling ad start in ".concat(deltaMs, "ms"));
|
|
4218
4471
|
}
|
|
4219
|
-
this.
|
|
4472
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4473
|
+
this.scheduledScte35BreakKey = cueKey;
|
|
4474
|
+
this.scheduleAdStartIn(deltaMs, marker, cueKey);
|
|
4220
4475
|
} else {
|
|
4221
4476
|
if (this.config.debugAdTiming) {
|
|
4222
4477
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (within tolerance)");
|
|
4223
4478
|
}
|
|
4224
4479
|
this.clearAdStartTimer();
|
|
4225
|
-
this.
|
|
4480
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4226
4481
|
}
|
|
4227
4482
|
} else {
|
|
4228
4483
|
if (this.config.debugAdTiming) {
|
|
4229
4484
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (fallback)");
|
|
4230
4485
|
}
|
|
4231
4486
|
this.clearAdStartTimer();
|
|
4232
|
-
this.
|
|
4233
|
-
}
|
|
4234
|
-
if (this.expectedAdBreakDurationMs != null) {
|
|
4235
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4487
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4236
4488
|
}
|
|
4237
4489
|
return;
|
|
4238
4490
|
}
|
|
@@ -4288,6 +4540,27 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4288
4540
|
}
|
|
4289
4541
|
}
|
|
4290
4542
|
},
|
|
4543
|
+
{
|
|
4544
|
+
key: "startScte35AdBreak",
|
|
4545
|
+
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4546
|
+
if (!this.video.muted) {
|
|
4547
|
+
this.video.muted = true;
|
|
4548
|
+
this.video.volume = 0;
|
|
4549
|
+
if (this.config.debugAdTiming) {
|
|
4550
|
+
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4553
|
+
this.inAdBreak = true;
|
|
4554
|
+
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4555
|
+
this.scheduledScte35BreakKey = void 0;
|
|
4556
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4557
|
+
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4558
|
+
this.handleAdStart(marker);
|
|
4559
|
+
if (this.expectedAdBreakDurationMs != null) {
|
|
4560
|
+
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
},
|
|
4291
4564
|
{
|
|
4292
4565
|
key: "parseCueOutDuration",
|
|
4293
4566
|
value: function parseCueOutDuration(value) {
|
|
@@ -4371,6 +4644,336 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4371
4644
|
return false;
|
|
4372
4645
|
}
|
|
4373
4646
|
},
|
|
4647
|
+
{
|
|
4648
|
+
key: "normalizeFragmentPayload",
|
|
4649
|
+
value: function normalizeFragmentPayload(payload) {
|
|
4650
|
+
if (_instanceof(payload, Uint8Array)) {
|
|
4651
|
+
return payload;
|
|
4652
|
+
}
|
|
4653
|
+
if (_instanceof(payload, ArrayBuffer)) {
|
|
4654
|
+
return new Uint8Array(payload);
|
|
4655
|
+
}
|
|
4656
|
+
if (ArrayBuffer.isView(payload)) {
|
|
4657
|
+
var view = payload;
|
|
4658
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
4659
|
+
}
|
|
4660
|
+
return void 0;
|
|
4661
|
+
}
|
|
4662
|
+
},
|
|
4663
|
+
{
|
|
4664
|
+
key: "processFragmentScte35Payload",
|
|
4665
|
+
value: function processFragmentScte35Payload(payloadData, fragmentSn, fragmentStartSeconds) {
|
|
4666
|
+
var _this = this;
|
|
4667
|
+
var payload = this.normalizeFragmentPayload(payloadData);
|
|
4668
|
+
if (!payload) {
|
|
4669
|
+
return;
|
|
4670
|
+
}
|
|
4671
|
+
var markers = this.parseScte35FromTsPackets(payload);
|
|
4672
|
+
markers.forEach(function(marker) {
|
|
4673
|
+
var context = {
|
|
4674
|
+
source: "ts",
|
|
4675
|
+
readiness: "early"
|
|
4676
|
+
};
|
|
4677
|
+
if (fragmentSn !== void 0) {
|
|
4678
|
+
context.fragmentSn = fragmentSn;
|
|
4679
|
+
}
|
|
4680
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4681
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4682
|
+
}
|
|
4683
|
+
_this.onScte35Cue(marker, context);
|
|
4684
|
+
});
|
|
4685
|
+
}
|
|
4686
|
+
},
|
|
4687
|
+
{
|
|
4688
|
+
key: "parseScte35FromTsPackets",
|
|
4689
|
+
value: function parseScte35FromTsPackets(data) {
|
|
4690
|
+
var packetInfo = this.detectTsPacketFormat(data);
|
|
4691
|
+
if (!packetInfo) {
|
|
4692
|
+
return [];
|
|
4693
|
+
}
|
|
4694
|
+
var markers = [];
|
|
4695
|
+
var sectionAssemblers = /* @__PURE__ */ new Map();
|
|
4696
|
+
for(var packetStart = packetInfo.offset; packetStart + packetInfo.packetSize <= data.length; packetStart += packetInfo.packetSize){
|
|
4697
|
+
var tsStart = packetStart + packetInfo.tsPayloadOffset;
|
|
4698
|
+
if (data[tsStart] !== 71) {
|
|
4699
|
+
continue;
|
|
4700
|
+
}
|
|
4701
|
+
var secondByte = data[tsStart + 1];
|
|
4702
|
+
var thirdByte = data[tsStart + 2];
|
|
4703
|
+
var fourthByte = data[tsStart + 3];
|
|
4704
|
+
if (secondByte == null || thirdByte == null || fourthByte == null || (secondByte & 128) !== 0) {
|
|
4705
|
+
continue;
|
|
4706
|
+
}
|
|
4707
|
+
var payloadUnitStart = (secondByte & 64) !== 0;
|
|
4708
|
+
var pid = (secondByte & 31) << 8 | thirdByte;
|
|
4709
|
+
var adaptationFieldControl = fourthByte >> 4 & 3;
|
|
4710
|
+
var hasPayload = adaptationFieldControl === 1 || adaptationFieldControl === 3;
|
|
4711
|
+
if (!hasPayload) {
|
|
4712
|
+
continue;
|
|
4713
|
+
}
|
|
4714
|
+
var payloadStart = tsStart + 4;
|
|
4715
|
+
if (adaptationFieldControl === 3) {
|
|
4716
|
+
var adaptationLength = data[payloadStart];
|
|
4717
|
+
if (adaptationLength == null) {
|
|
4718
|
+
continue;
|
|
4719
|
+
}
|
|
4720
|
+
payloadStart += 1 + adaptationLength;
|
|
4721
|
+
}
|
|
4722
|
+
var payloadEnd = Math.min(tsStart + 188, data.length);
|
|
4723
|
+
if (payloadStart >= payloadEnd || payloadStart >= data.length) {
|
|
4724
|
+
continue;
|
|
4725
|
+
}
|
|
4726
|
+
var payload = data.subarray(payloadStart, payloadEnd);
|
|
4727
|
+
if (pid === 0) {
|
|
4728
|
+
this.parsePatSection(payload, payloadUnitStart);
|
|
4729
|
+
} else if (this.pmtPids.has(pid)) {
|
|
4730
|
+
this.parsePmtSection(payload, payloadUnitStart);
|
|
4731
|
+
} else if (this.tsScte35Pids.has(pid)) {
|
|
4732
|
+
this.collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, sectionAssemblers, markers);
|
|
4733
|
+
}
|
|
4734
|
+
}
|
|
4735
|
+
return markers;
|
|
4736
|
+
}
|
|
4737
|
+
},
|
|
4738
|
+
{
|
|
4739
|
+
key: "detectTsPacketFormat",
|
|
4740
|
+
value: function detectTsPacketFormat(data) {
|
|
4741
|
+
var packetSizes = [
|
|
4742
|
+
188,
|
|
4743
|
+
192,
|
|
4744
|
+
204
|
|
4745
|
+
];
|
|
4746
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4747
|
+
try {
|
|
4748
|
+
for(var _iterator = packetSizes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4749
|
+
var packetSize = _step.value;
|
|
4750
|
+
var tsPayloadOffset = packetSize === 192 ? 4 : 0;
|
|
4751
|
+
for(var offset = 0; offset < packetSize; offset++){
|
|
4752
|
+
var matchedPackets = 0;
|
|
4753
|
+
for(var packetStart = offset; packetStart + tsPayloadOffset < data.length && matchedPackets < 5; packetStart += packetSize){
|
|
4754
|
+
if (data[packetStart + tsPayloadOffset] !== 71) {
|
|
4755
|
+
break;
|
|
4756
|
+
}
|
|
4757
|
+
matchedPackets++;
|
|
4758
|
+
}
|
|
4759
|
+
if (matchedPackets >= 2) {
|
|
4760
|
+
return {
|
|
4761
|
+
offset: offset,
|
|
4762
|
+
packetSize: packetSize,
|
|
4763
|
+
tsPayloadOffset: tsPayloadOffset
|
|
4764
|
+
};
|
|
4765
|
+
}
|
|
4766
|
+
}
|
|
4767
|
+
}
|
|
4768
|
+
} catch (err) {
|
|
4769
|
+
_didIteratorError = true;
|
|
4770
|
+
_iteratorError = err;
|
|
4771
|
+
} finally{
|
|
4772
|
+
try {
|
|
4773
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4774
|
+
_iterator.return();
|
|
4775
|
+
}
|
|
4776
|
+
} finally{
|
|
4777
|
+
if (_didIteratorError) {
|
|
4778
|
+
throw _iteratorError;
|
|
4779
|
+
}
|
|
4780
|
+
}
|
|
4781
|
+
}
|
|
4782
|
+
return void 0;
|
|
4783
|
+
}
|
|
4784
|
+
},
|
|
4785
|
+
{
|
|
4786
|
+
key: "parsePatSection",
|
|
4787
|
+
value: function parsePatSection(payload, payloadUnitStart) {
|
|
4788
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4789
|
+
if (sectionStart == null || sectionStart + 8 >= payload.length) {
|
|
4790
|
+
return;
|
|
4791
|
+
}
|
|
4792
|
+
if (payload[sectionStart] !== 0) {
|
|
4793
|
+
return;
|
|
4794
|
+
}
|
|
4795
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4796
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4797
|
+
for(var offset = sectionStart + 8; offset + 4 <= sectionEnd - 4; offset += 4){
|
|
4798
|
+
var _payload_offset, _payload_, _payload_1, _payload_2;
|
|
4799
|
+
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);
|
|
4800
|
+
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);
|
|
4801
|
+
if (programNumber !== 0) {
|
|
4802
|
+
this.pmtPids.add(pid);
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
},
|
|
4807
|
+
{
|
|
4808
|
+
key: "parsePmtSection",
|
|
4809
|
+
value: function parsePmtSection(payload, payloadUnitStart) {
|
|
4810
|
+
var _payload_, _payload_1;
|
|
4811
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4812
|
+
if (sectionStart == null || sectionStart + 12 >= payload.length) {
|
|
4813
|
+
return;
|
|
4814
|
+
}
|
|
4815
|
+
if (payload[sectionStart] !== 2) {
|
|
4816
|
+
return;
|
|
4817
|
+
}
|
|
4818
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4819
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4820
|
+
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);
|
|
4821
|
+
var offset = sectionStart + 12 + programInfoLength;
|
|
4822
|
+
while(offset + 5 <= sectionEnd - 4){
|
|
4823
|
+
var _payload_offset, _payload_2, _payload_3, _payload_4, _payload_5;
|
|
4824
|
+
var streamType = (_payload_offset = payload[offset]) !== null && _payload_offset !== void 0 ? _payload_offset : 0;
|
|
4825
|
+
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);
|
|
4826
|
+
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);
|
|
4827
|
+
var descriptorStart = offset + 5;
|
|
4828
|
+
var descriptorEnd = Math.min(descriptorStart + esInfoLength, sectionEnd - 4);
|
|
4829
|
+
if (streamType === 134 || streamType === 6 && this.descriptorsIdentifyScte35(payload, descriptorStart, descriptorEnd)) {
|
|
4830
|
+
this.tsScte35Pids.add(elementaryPid);
|
|
4831
|
+
}
|
|
4832
|
+
offset = descriptorStart + esInfoLength;
|
|
4833
|
+
}
|
|
4834
|
+
}
|
|
4835
|
+
},
|
|
4836
|
+
{
|
|
4837
|
+
key: "descriptorsIdentifyScte35",
|
|
4838
|
+
value: function descriptorsIdentifyScte35(data, start, end) {
|
|
4839
|
+
var offset = start;
|
|
4840
|
+
while(offset + 2 <= end){
|
|
4841
|
+
var _data_offset, _data_, _data_descriptorStart, _data_1, _data_2, _data_3;
|
|
4842
|
+
var tag = (_data_offset = data[offset]) !== null && _data_offset !== void 0 ? _data_offset : 0;
|
|
4843
|
+
var length = (_data_ = data[offset + 1]) !== null && _data_ !== void 0 ? _data_ : 0;
|
|
4844
|
+
var descriptorStart = offset + 2;
|
|
4845
|
+
var descriptorEnd = descriptorStart + length;
|
|
4846
|
+
if (descriptorEnd > end) {
|
|
4847
|
+
return false;
|
|
4848
|
+
}
|
|
4849
|
+
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) : "";
|
|
4850
|
+
if (tag === 138 || registration === "CUEI" || registration === "SCTE") {
|
|
4851
|
+
return true;
|
|
4852
|
+
}
|
|
4853
|
+
offset = descriptorEnd;
|
|
4854
|
+
}
|
|
4855
|
+
return false;
|
|
4856
|
+
}
|
|
4857
|
+
},
|
|
4858
|
+
{
|
|
4859
|
+
key: "collectScte35SectionsFromPayload",
|
|
4860
|
+
value: function collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, assemblers, markers) {
|
|
4861
|
+
if (payload.length === 0) {
|
|
4862
|
+
return;
|
|
4863
|
+
}
|
|
4864
|
+
var offset = 0;
|
|
4865
|
+
if (payloadUnitStart) {
|
|
4866
|
+
var _payload_;
|
|
4867
|
+
var pointerField = (_payload_ = payload[0]) !== null && _payload_ !== void 0 ? _payload_ : 0;
|
|
4868
|
+
var previousAssembler = assemblers.get(pid);
|
|
4869
|
+
if (previousAssembler && pointerField > 0) {
|
|
4870
|
+
this.appendScte35Bytes(pid, payload.subarray(1, Math.min(1 + pointerField, payload.length)), assemblers, markers);
|
|
4871
|
+
}
|
|
4872
|
+
assemblers.delete(pid);
|
|
4873
|
+
offset = 1 + pointerField;
|
|
4874
|
+
} else {
|
|
4875
|
+
this.appendScte35Bytes(pid, payload, assemblers, markers);
|
|
4876
|
+
return;
|
|
4877
|
+
}
|
|
4878
|
+
while(offset + 3 <= payload.length){
|
|
4879
|
+
var tableId = payload[offset];
|
|
4880
|
+
if (tableId == null || tableId === 255) {
|
|
4881
|
+
return;
|
|
4882
|
+
}
|
|
4883
|
+
var sectionLength = this.getPsiSectionLength(payload, offset);
|
|
4884
|
+
var totalLength = 3 + sectionLength;
|
|
4885
|
+
if (sectionLength <= 0 || totalLength <= 3) {
|
|
4886
|
+
return;
|
|
4887
|
+
}
|
|
4888
|
+
if (offset + totalLength <= payload.length) {
|
|
4889
|
+
this.addScte35SectionMarker(payload.subarray(offset, offset + totalLength), markers);
|
|
4890
|
+
offset += totalLength;
|
|
4891
|
+
} else {
|
|
4892
|
+
assemblers.set(pid, {
|
|
4893
|
+
bytes: Array.from(payload.subarray(offset)),
|
|
4894
|
+
expectedLength: totalLength
|
|
4895
|
+
});
|
|
4896
|
+
return;
|
|
4897
|
+
}
|
|
4898
|
+
}
|
|
4899
|
+
}
|
|
4900
|
+
},
|
|
4901
|
+
{
|
|
4902
|
+
key: "appendScte35Bytes",
|
|
4903
|
+
value: function appendScte35Bytes(pid, bytes, assemblers, markers) {
|
|
4904
|
+
var assembler = assemblers.get(pid);
|
|
4905
|
+
if (!assembler) {
|
|
4906
|
+
return;
|
|
4907
|
+
}
|
|
4908
|
+
for(var i = 0; i < bytes.length && assembler.bytes.length < assembler.expectedLength; i++){
|
|
4909
|
+
var _bytes_i;
|
|
4910
|
+
assembler.bytes.push((_bytes_i = bytes[i]) !== null && _bytes_i !== void 0 ? _bytes_i : 0);
|
|
4911
|
+
}
|
|
4912
|
+
if (assembler.bytes.length >= assembler.expectedLength) {
|
|
4913
|
+
assemblers.delete(pid);
|
|
4914
|
+
this.addScte35SectionMarker(new Uint8Array(assembler.bytes), markers);
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
},
|
|
4918
|
+
{
|
|
4919
|
+
key: "addScte35SectionMarker",
|
|
4920
|
+
value: function addScte35SectionMarker(section, markers) {
|
|
4921
|
+
if (section[0] !== 252 || this.hasProcessedTsScte35Section(section)) {
|
|
4922
|
+
return;
|
|
4923
|
+
}
|
|
4924
|
+
var marker = this.parseScte35Binary(section);
|
|
4925
|
+
if (!marker) {
|
|
4926
|
+
return;
|
|
4927
|
+
}
|
|
4928
|
+
marker.raw = _object_spread_props(_object_spread({}, _type_of(marker.raw) === "object" && marker.raw ? marker.raw : {}), {
|
|
4929
|
+
source: "ts-packet"
|
|
4930
|
+
});
|
|
4931
|
+
markers.push(marker);
|
|
4932
|
+
}
|
|
4933
|
+
},
|
|
4934
|
+
{
|
|
4935
|
+
key: "hasProcessedTsScte35Section",
|
|
4936
|
+
value: function hasProcessedTsScte35Section(section) {
|
|
4937
|
+
var checksum = 0;
|
|
4938
|
+
for(var i = 0; i < section.length; i++){
|
|
4939
|
+
var _section_i;
|
|
4940
|
+
checksum = checksum * 31 + ((_section_i = section[i]) !== null && _section_i !== void 0 ? _section_i : 0) >>> 0;
|
|
4941
|
+
}
|
|
4942
|
+
var key = "".concat(section.length, ":").concat(checksum);
|
|
4943
|
+
if (this.processedTsScte35Sections.has(key)) {
|
|
4944
|
+
return true;
|
|
4945
|
+
}
|
|
4946
|
+
this.processedTsScte35Sections.add(key);
|
|
4947
|
+
if (this.processedTsScte35Sections.size > 200) {
|
|
4948
|
+
var firstKey = this.processedTsScte35Sections.values().next().value;
|
|
4949
|
+
if (firstKey) {
|
|
4950
|
+
this.processedTsScte35Sections.delete(firstKey);
|
|
4951
|
+
}
|
|
4952
|
+
}
|
|
4953
|
+
return false;
|
|
4954
|
+
}
|
|
4955
|
+
},
|
|
4956
|
+
{
|
|
4957
|
+
key: "getPsiSectionStart",
|
|
4958
|
+
value: function getPsiSectionStart(payload, payloadUnitStart) {
|
|
4959
|
+
if (!payloadUnitStart) {
|
|
4960
|
+
return void 0;
|
|
4961
|
+
}
|
|
4962
|
+
var pointerField = payload[0];
|
|
4963
|
+
if (pointerField == null) {
|
|
4964
|
+
return void 0;
|
|
4965
|
+
}
|
|
4966
|
+
var sectionStart = 1 + pointerField;
|
|
4967
|
+
return sectionStart < payload.length ? sectionStart : void 0;
|
|
4968
|
+
}
|
|
4969
|
+
},
|
|
4970
|
+
{
|
|
4971
|
+
key: "getPsiSectionLength",
|
|
4972
|
+
value: function getPsiSectionLength(data, offset) {
|
|
4973
|
+
var _data_, _data_1;
|
|
4974
|
+
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);
|
|
4975
|
+
}
|
|
4976
|
+
},
|
|
4374
4977
|
{
|
|
4375
4978
|
key: "parseScte35Binary",
|
|
4376
4979
|
value: function parseScte35Binary(data) {
|
|
@@ -4410,10 +5013,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4410
5013
|
value: function skipBits(n) {
|
|
4411
5014
|
this.readBits(n);
|
|
4412
5015
|
}
|
|
5016
|
+
},
|
|
5017
|
+
{
|
|
5018
|
+
key: "bytePosition",
|
|
5019
|
+
get: function get() {
|
|
5020
|
+
return this.bitPos === 0 ? this.bytePos : this.bytePos + 1;
|
|
5021
|
+
}
|
|
4413
5022
|
}
|
|
4414
5023
|
]);
|
|
4415
5024
|
return BitReader;
|
|
4416
5025
|
}();
|
|
5026
|
+
var readSpliceTime = function readSpliceTime(r2, ptsAdjustmentTicks2) {
|
|
5027
|
+
var timeSpecifiedFlag = r2.readBits(1) === 1;
|
|
5028
|
+
if (!timeSpecifiedFlag) {
|
|
5029
|
+
r2.readBits(7);
|
|
5030
|
+
return void 0;
|
|
5031
|
+
}
|
|
5032
|
+
r2.readBits(6);
|
|
5033
|
+
var high = r2.readBits(1);
|
|
5034
|
+
var low = r2.readBits(32);
|
|
5035
|
+
var ptsTicks = (high * 4294967296 + low + ptsAdjustmentTicks2) % 8589934592;
|
|
5036
|
+
return ptsTicks / 9e4;
|
|
5037
|
+
};
|
|
4417
5038
|
var r = new BitReader(data);
|
|
4418
5039
|
var tableId = r.readBits(8);
|
|
4419
5040
|
if (tableId !== 252) return void 0;
|
|
@@ -4421,77 +5042,206 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4421
5042
|
r.readBits(1);
|
|
4422
5043
|
r.readBits(2);
|
|
4423
5044
|
var sectionLength = r.readBits(12);
|
|
5045
|
+
if (sectionLength <= 0 || data.length < 3 + sectionLength) {
|
|
5046
|
+
return void 0;
|
|
5047
|
+
}
|
|
4424
5048
|
r.readBits(8);
|
|
4425
5049
|
r.readBits(1);
|
|
4426
5050
|
r.readBits(6);
|
|
4427
5051
|
var ptsAdjHigh = r.readBits(1);
|
|
4428
5052
|
var ptsAdjLow = r.readBits(32);
|
|
4429
|
-
|
|
4430
|
-
void ptsAdjLow;
|
|
5053
|
+
var ptsAdjustmentTicks = ptsAdjHigh * 4294967296 + ptsAdjLow;
|
|
4431
5054
|
r.readBits(8);
|
|
4432
5055
|
r.readBits(12);
|
|
4433
5056
|
var spliceCommandLength = r.readBits(12);
|
|
4434
5057
|
var spliceCommandType = r.readBits(8);
|
|
4435
|
-
|
|
5058
|
+
var markerType;
|
|
5059
|
+
var durationSeconds = void 0;
|
|
5060
|
+
var ptsSeconds = void 0;
|
|
5061
|
+
var spliceEventId = void 0;
|
|
5062
|
+
var commandBodyStart = r.bytePosition;
|
|
5063
|
+
if (spliceCommandType === 5) {
|
|
5064
|
+
spliceEventId = r.readBits(32);
|
|
5065
|
+
var cancel = r.readBits(1) === 1;
|
|
5066
|
+
r.readBits(7);
|
|
5067
|
+
if (cancel) return void 0;
|
|
5068
|
+
var outOfNetwork = r.readBits(1) === 1;
|
|
5069
|
+
var programSpliceFlag = r.readBits(1) === 1;
|
|
5070
|
+
var durationFlag = r.readBits(1) === 1;
|
|
5071
|
+
var spliceImmediateFlag = r.readBits(1) === 1;
|
|
5072
|
+
r.readBits(4);
|
|
5073
|
+
markerType = outOfNetwork ? "start" : "end";
|
|
5074
|
+
if (programSpliceFlag && !spliceImmediateFlag) {
|
|
5075
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5076
|
+
} else if (!programSpliceFlag) {
|
|
5077
|
+
var componentCount = r.readBits(8);
|
|
5078
|
+
for(var i = 0; i < componentCount; i++){
|
|
5079
|
+
r.readBits(8);
|
|
5080
|
+
if (!spliceImmediateFlag) {
|
|
5081
|
+
var componentPtsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5082
|
+
if (ptsSeconds === void 0) {
|
|
5083
|
+
ptsSeconds = componentPtsSeconds;
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5087
|
+
}
|
|
5088
|
+
if (durationFlag) {
|
|
5089
|
+
r.readBits(6);
|
|
5090
|
+
r.readBits(1);
|
|
5091
|
+
var high = r.readBits(1);
|
|
5092
|
+
var low = r.readBits(32);
|
|
5093
|
+
var durationTicks = high * 4294967296 + low;
|
|
5094
|
+
durationSeconds = durationTicks / 9e4;
|
|
5095
|
+
}
|
|
5096
|
+
r.readBits(16);
|
|
5097
|
+
r.readBits(8);
|
|
5098
|
+
r.readBits(8);
|
|
5099
|
+
} else if (spliceCommandType === 6) {
|
|
5100
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5101
|
+
} else {
|
|
4436
5102
|
return void 0;
|
|
4437
5103
|
}
|
|
4438
|
-
r.
|
|
4439
|
-
var
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
}
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
5104
|
+
var expectedDescriptorOffset = spliceCommandLength === 4095 ? r.bytePosition : commandBodyStart + spliceCommandLength;
|
|
5105
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptors(data, expectedDescriptorOffset);
|
|
5106
|
+
if (descriptorMarker) {
|
|
5107
|
+
markerType = descriptorMarker.type;
|
|
5108
|
+
if (durationSeconds === void 0) {
|
|
5109
|
+
durationSeconds = descriptorMarker.durationSeconds;
|
|
5110
|
+
}
|
|
5111
|
+
}
|
|
5112
|
+
if (!markerType) {
|
|
5113
|
+
return void 0;
|
|
5114
|
+
}
|
|
5115
|
+
var marker = _object_spread_props(_object_spread({
|
|
5116
|
+
type: markerType
|
|
5117
|
+
}, ptsSeconds !== void 0 ? {
|
|
5118
|
+
ptsSeconds: ptsSeconds
|
|
5119
|
+
} : {}, durationSeconds !== void 0 ? {
|
|
5120
|
+
durationSeconds: durationSeconds
|
|
5121
|
+
} : {}), {
|
|
5122
|
+
raw: _object_spread({
|
|
5123
|
+
splice_command_type: spliceCommandType
|
|
5124
|
+
}, spliceEventId !== void 0 ? {
|
|
5125
|
+
splice_event_id: spliceEventId
|
|
5126
|
+
} : {}, (descriptorMarker === null || descriptorMarker === void 0 ? void 0 : descriptorMarker.segmentationEventId) !== void 0 ? {
|
|
5127
|
+
segmentation_event_id: descriptorMarker.segmentationEventId
|
|
5128
|
+
} : {})
|
|
5129
|
+
});
|
|
5130
|
+
return marker;
|
|
5131
|
+
}
|
|
5132
|
+
},
|
|
5133
|
+
{
|
|
5134
|
+
key: "parseScte35SegmentationDescriptors",
|
|
5135
|
+
value: function parseScte35SegmentationDescriptors(data, offset) {
|
|
5136
|
+
var _data_offset, _data_;
|
|
5137
|
+
if (offset + 2 > data.length) {
|
|
5138
|
+
return void 0;
|
|
5139
|
+
}
|
|
5140
|
+
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);
|
|
5141
|
+
var descriptorOffset = offset + 2;
|
|
5142
|
+
var descriptorEnd = Math.min(data.length, descriptorOffset + descriptorLoopLength);
|
|
5143
|
+
while(descriptorOffset + 2 <= descriptorEnd){
|
|
5144
|
+
var _data_descriptorOffset, _data_1;
|
|
5145
|
+
var descriptorTag = (_data_descriptorOffset = data[descriptorOffset]) !== null && _data_descriptorOffset !== void 0 ? _data_descriptorOffset : 0;
|
|
5146
|
+
var descriptorLength = (_data_1 = data[descriptorOffset + 1]) !== null && _data_1 !== void 0 ? _data_1 : 0;
|
|
5147
|
+
var descriptorDataStart = descriptorOffset + 2;
|
|
5148
|
+
var descriptorDataEnd = descriptorDataStart + descriptorLength;
|
|
5149
|
+
if (descriptorDataEnd > descriptorEnd) {
|
|
5150
|
+
return void 0;
|
|
5151
|
+
}
|
|
5152
|
+
if (descriptorTag === 2) {
|
|
5153
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptor(data.subarray(descriptorDataStart, descriptorDataEnd));
|
|
5154
|
+
if (descriptorMarker) {
|
|
5155
|
+
return descriptorMarker;
|
|
4467
5156
|
}
|
|
4468
5157
|
}
|
|
5158
|
+
descriptorOffset = descriptorDataEnd;
|
|
5159
|
+
}
|
|
5160
|
+
return void 0;
|
|
5161
|
+
}
|
|
5162
|
+
},
|
|
5163
|
+
{
|
|
5164
|
+
key: "parseScte35SegmentationDescriptor",
|
|
5165
|
+
value: function parseScte35SegmentationDescriptor(descriptor) {
|
|
5166
|
+
var _descriptor_, _descriptor_1, _descriptor_2, _descriptor_3, _descriptor_4, _descriptor_5, _descriptor_6, _descriptor_7, _descriptor_8, _descriptor_9, _descriptor_offset, _descriptor_offset1;
|
|
5167
|
+
if (descriptor.length < 11) {
|
|
5168
|
+
return void 0;
|
|
5169
|
+
}
|
|
5170
|
+
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);
|
|
5171
|
+
if (identifier !== "CUEI") {
|
|
5172
|
+
return void 0;
|
|
5173
|
+
}
|
|
5174
|
+
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);
|
|
5175
|
+
var cancelIndicator = (((_descriptor_8 = descriptor[8]) !== null && _descriptor_8 !== void 0 ? _descriptor_8 : 0) & 128) !== 0;
|
|
5176
|
+
if (cancelIndicator) {
|
|
5177
|
+
return void 0;
|
|
5178
|
+
}
|
|
5179
|
+
var flags = (_descriptor_9 = descriptor[9]) !== null && _descriptor_9 !== void 0 ? _descriptor_9 : 0;
|
|
5180
|
+
var programSegmentationFlag = (flags & 128) !== 0;
|
|
5181
|
+
var segmentationDurationFlag = (flags & 64) !== 0;
|
|
5182
|
+
var offset = 10;
|
|
5183
|
+
if (!programSegmentationFlag) {
|
|
5184
|
+
var _descriptor_offset2;
|
|
5185
|
+
var componentCount = (_descriptor_offset2 = descriptor[offset]) !== null && _descriptor_offset2 !== void 0 ? _descriptor_offset2 : 0;
|
|
5186
|
+
offset += 1 + componentCount * 6;
|
|
5187
|
+
if (offset > descriptor.length) {
|
|
5188
|
+
return void 0;
|
|
5189
|
+
}
|
|
4469
5190
|
}
|
|
4470
5191
|
var durationSeconds = void 0;
|
|
4471
|
-
if (
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
var durationTicks =
|
|
5192
|
+
if (segmentationDurationFlag) {
|
|
5193
|
+
var _descriptor_offset3, _descriptor_10, _descriptor_11, _descriptor_12, _descriptor_13;
|
|
5194
|
+
if (offset + 5 > descriptor.length) {
|
|
5195
|
+
return void 0;
|
|
5196
|
+
}
|
|
5197
|
+
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);
|
|
4477
5198
|
durationSeconds = durationTicks / 9e4;
|
|
5199
|
+
offset += 5;
|
|
4478
5200
|
}
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
5201
|
+
if (offset + 2 > descriptor.length) {
|
|
5202
|
+
return void 0;
|
|
5203
|
+
}
|
|
5204
|
+
offset += 1;
|
|
5205
|
+
var segmentationUpidLength = (_descriptor_offset = descriptor[offset]) !== null && _descriptor_offset !== void 0 ? _descriptor_offset : 0;
|
|
5206
|
+
offset += 1 + segmentationUpidLength;
|
|
5207
|
+
if (offset >= descriptor.length) {
|
|
5208
|
+
return void 0;
|
|
5209
|
+
}
|
|
5210
|
+
var segmentationTypeId = (_descriptor_offset1 = descriptor[offset]) !== null && _descriptor_offset1 !== void 0 ? _descriptor_offset1 : 0;
|
|
5211
|
+
var markerType = this.markerTypeFromSegmentationTypeId(segmentationTypeId);
|
|
5212
|
+
if (!markerType) {
|
|
5213
|
+
return void 0;
|
|
5214
|
+
}
|
|
5215
|
+
return _object_spread_props(_object_spread({
|
|
5216
|
+
type: markerType
|
|
5217
|
+
}, durationSeconds !== void 0 ? {
|
|
5218
|
+
durationSeconds: durationSeconds
|
|
5219
|
+
} : {}), {
|
|
5220
|
+
segmentationEventId: segmentationEventId
|
|
5221
|
+
});
|
|
5222
|
+
}
|
|
5223
|
+
},
|
|
5224
|
+
{
|
|
5225
|
+
key: "markerTypeFromSegmentationTypeId",
|
|
5226
|
+
value: function markerTypeFromSegmentationTypeId(segmentationTypeId) {
|
|
5227
|
+
switch(segmentationTypeId){
|
|
5228
|
+
case 16:
|
|
5229
|
+
case 34:
|
|
5230
|
+
case 48:
|
|
5231
|
+
case 50:
|
|
5232
|
+
case 52:
|
|
5233
|
+
case 54:
|
|
5234
|
+
return "start";
|
|
5235
|
+
case 17:
|
|
5236
|
+
case 35:
|
|
5237
|
+
case 49:
|
|
5238
|
+
case 51:
|
|
5239
|
+
case 53:
|
|
5240
|
+
case 55:
|
|
5241
|
+
return "end";
|
|
5242
|
+
default:
|
|
5243
|
+
return void 0;
|
|
4493
5244
|
}
|
|
4494
|
-
return void 0;
|
|
4495
5245
|
}
|
|
4496
5246
|
},
|
|
4497
5247
|
{
|
|
@@ -4888,7 +5638,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4888
5638
|
},
|
|
4889
5639
|
{
|
|
4890
5640
|
key: "startAdPrefetch",
|
|
4891
|
-
value: function startAdPrefetch(marker, fragmentSn) {
|
|
5641
|
+
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
4892
5642
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
4893
5643
|
return;
|
|
4894
5644
|
}
|
|
@@ -4916,6 +5666,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4916
5666
|
isFetching: false,
|
|
4917
5667
|
fetchStartTime: Date.now()
|
|
4918
5668
|
});
|
|
5669
|
+
this.pendingScte35CueKey = cueKey;
|
|
4919
5670
|
this.adDetectSentForCurrentBreak = true;
|
|
4920
5671
|
var detectPayload = {};
|
|
4921
5672
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
@@ -4937,6 +5688,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4937
5688
|
this.prefetchTimerId = void 0;
|
|
4938
5689
|
}
|
|
4939
5690
|
this.pendingAdBreak = null;
|
|
5691
|
+
this.pendingScte35CueKey = void 0;
|
|
4940
5692
|
}
|
|
4941
5693
|
},
|
|
4942
5694
|
{
|
|
@@ -6420,18 +7172,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6420
7172
|
key: "scheduleAdStartIn",
|
|
6421
7173
|
value: function scheduleAdStartIn(delayMs) {
|
|
6422
7174
|
var _this = this;
|
|
7175
|
+
var marker = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7176
|
+
type: "start"
|
|
7177
|
+
}, cueKey = arguments.length > 2 ? arguments[2] : void 0;
|
|
6423
7178
|
this.clearAdStartTimer();
|
|
6424
7179
|
var ms = Math.max(0, Math.floor(delayMs));
|
|
6425
7180
|
if (ms === 0) {
|
|
6426
|
-
this.
|
|
6427
|
-
type: "start"
|
|
6428
|
-
}).catch(function() {});
|
|
7181
|
+
this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0);
|
|
6429
7182
|
return;
|
|
6430
7183
|
}
|
|
6431
7184
|
this.adStartTimerId = window.setTimeout(function() {
|
|
6432
|
-
_this.
|
|
6433
|
-
type: "start"
|
|
6434
|
-
}).catch(function() {});
|
|
7185
|
+
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.expectedAdBreakDurationMs);
|
|
6435
7186
|
}, ms);
|
|
6436
7187
|
}
|
|
6437
7188
|
},
|
|
@@ -6862,6 +7613,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6862
7613
|
this.adRequestQueue = [];
|
|
6863
7614
|
this.inAdBreak = false;
|
|
6864
7615
|
this.adDetectSentForCurrentBreak = false;
|
|
7616
|
+
this.activeScte35BreakKey = void 0;
|
|
7617
|
+
this.scheduledScte35BreakKey = void 0;
|
|
6865
7618
|
this.expectedAdBreakDurationMs = void 0;
|
|
6866
7619
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
6867
7620
|
this.clearAdStartTimer();
|