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
|
@@ -3262,6 +3262,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3262
3262
|
this.adRequestQueue = [];
|
|
3263
3263
|
this.maxPlaceholderDurationMs = 5e3;
|
|
3264
3264
|
this.isShowingPlaceholder = false;
|
|
3265
|
+
this.tsScte35Pids = /* @__PURE__ */ new Set();
|
|
3266
|
+
this.pmtPids = /* @__PURE__ */ new Set();
|
|
3267
|
+
this.processedTsScte35Sections = /* @__PURE__ */ new Set();
|
|
3268
|
+
this.pendingScte35Cues = /* @__PURE__ */ new Map();
|
|
3269
|
+
this.recentScte35CueKeys = /* @__PURE__ */ new Map();
|
|
3270
|
+
this.recentScte35CueLimit = 200;
|
|
3265
3271
|
this.totalAdRequestsInBreak = 0;
|
|
3266
3272
|
this.maxTotalAdRequestsPerBreak = 10;
|
|
3267
3273
|
this.pendingAdBreak = null;
|
|
@@ -3531,7 +3537,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3531
3537
|
if (_this.config.debugAdTiming) {
|
|
3532
3538
|
console.log("[StormcloudVideoPlayer] \uD83C\uDFAF EARLY SCTE-35 DETECTION: Ad break marker found in fragment", i, "- starting pre-fetch (NOT playing yet)");
|
|
3533
3539
|
}
|
|
3534
|
-
_this.
|
|
3540
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "early", frag)));
|
|
3535
3541
|
return;
|
|
3536
3542
|
}
|
|
3537
3543
|
}
|
|
@@ -3612,10 +3618,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3612
3618
|
return _this.onId3Tag(tag);
|
|
3613
3619
|
});
|
|
3614
3620
|
});
|
|
3621
|
+
this.hls.on(import_hls2.default.Events.FRAG_LOADED, function(_evt, data) {
|
|
3622
|
+
var _data_frag;
|
|
3623
|
+
_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));
|
|
3624
|
+
});
|
|
3625
|
+
this.hls.on(import_hls2.default.Events.FRAG_DECRYPTED, function(_evt, data) {
|
|
3626
|
+
var _data_frag;
|
|
3627
|
+
_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));
|
|
3628
|
+
});
|
|
3615
3629
|
this.hls.on(import_hls2.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
3616
3630
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
3617
3631
|
var tagList = frag === null || frag === void 0 ? void 0 : frag.tagList;
|
|
3618
|
-
if (!Array.isArray(tagList))
|
|
3632
|
+
if (!Array.isArray(tagList)) {
|
|
3633
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3634
|
+
return;
|
|
3635
|
+
}
|
|
3619
3636
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3620
3637
|
try {
|
|
3621
3638
|
for(var _iterator = tagList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -3651,7 +3668,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3651
3668
|
value: value
|
|
3652
3669
|
}
|
|
3653
3670
|
});
|
|
3654
|
-
_this.
|
|
3671
|
+
_this.onScte35Cue(marker, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3655
3672
|
} else if (tag.includes("EXT-X-CUE-OUT")) {
|
|
3656
3673
|
var durationSeconds = _this.parseCueOutDuration(value);
|
|
3657
3674
|
var marker1 = _object_spread_props(_object_spread({
|
|
@@ -3664,15 +3681,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3664
3681
|
value: value
|
|
3665
3682
|
}
|
|
3666
3683
|
});
|
|
3667
|
-
_this.
|
|
3684
|
+
_this.onScte35Cue(marker1, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3668
3685
|
} else if (tag.includes("EXT-X-CUE-IN")) {
|
|
3669
|
-
_this.
|
|
3686
|
+
_this.onScte35Cue({
|
|
3670
3687
|
type: "end",
|
|
3671
3688
|
raw: {
|
|
3672
3689
|
tag: tag,
|
|
3673
3690
|
value: value
|
|
3674
3691
|
}
|
|
3675
|
-
});
|
|
3692
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3676
3693
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
3677
3694
|
var _attrs_CLASS;
|
|
3678
3695
|
var attrs = _this.parseAttributeList(value);
|
|
@@ -3692,17 +3709,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3692
3709
|
attrs: attrs
|
|
3693
3710
|
}
|
|
3694
3711
|
});
|
|
3695
|
-
_this.
|
|
3712
|
+
_this.onScte35Cue(marker2, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3696
3713
|
}
|
|
3697
3714
|
if (hasScteIn) {
|
|
3698
|
-
_this.
|
|
3715
|
+
_this.onScte35Cue({
|
|
3699
3716
|
type: "end",
|
|
3700
3717
|
raw: {
|
|
3701
3718
|
tag: tag,
|
|
3702
3719
|
value: value,
|
|
3703
3720
|
attrs: attrs
|
|
3704
3721
|
}
|
|
3705
|
-
});
|
|
3722
|
+
}, _object_spread({}, _this.createScte35CueContext("manifest", "playback", frag)));
|
|
3706
3723
|
}
|
|
3707
3724
|
}
|
|
3708
3725
|
}
|
|
@@ -3720,6 +3737,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3720
3737
|
}
|
|
3721
3738
|
}
|
|
3722
3739
|
}
|
|
3740
|
+
_this.activatePendingScte35CuesForFragment(frag);
|
|
3723
3741
|
});
|
|
3724
3742
|
this.hls.on(import_hls2.default.Events.ERROR, function(_evt, data) {
|
|
3725
3743
|
if (data === null || data === void 0 ? void 0 : data.fatal) {
|
|
@@ -4025,7 +4043,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4025
4043
|
}
|
|
4026
4044
|
var marker = this.parseScte35FromId3(tag);
|
|
4027
4045
|
if (marker) {
|
|
4028
|
-
this.
|
|
4046
|
+
this.onScte35Cue(marker, {
|
|
4047
|
+
source: "id3",
|
|
4048
|
+
readiness: "playback"
|
|
4049
|
+
});
|
|
4029
4050
|
}
|
|
4030
4051
|
}
|
|
4031
4052
|
},
|
|
@@ -4169,9 +4190,251 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4169
4190
|
}
|
|
4170
4191
|
}
|
|
4171
4192
|
},
|
|
4193
|
+
{
|
|
4194
|
+
key: "createScte35CueContext",
|
|
4195
|
+
value: function createScte35CueContext(source, readiness, frag) {
|
|
4196
|
+
var context = {
|
|
4197
|
+
source: source,
|
|
4198
|
+
readiness: readiness
|
|
4199
|
+
};
|
|
4200
|
+
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
4201
|
+
context.fragmentSn = frag.sn;
|
|
4202
|
+
}
|
|
4203
|
+
var fragmentStartSeconds = this.getFragmentStartSeconds(frag);
|
|
4204
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4205
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4206
|
+
}
|
|
4207
|
+
return context;
|
|
4208
|
+
}
|
|
4209
|
+
},
|
|
4210
|
+
{
|
|
4211
|
+
key: "getFragmentStartSeconds",
|
|
4212
|
+
value: function getFragmentStartSeconds(frag) {
|
|
4213
|
+
var candidates = [
|
|
4214
|
+
frag === null || frag === void 0 ? void 0 : frag.start,
|
|
4215
|
+
frag === null || frag === void 0 ? void 0 : frag.startPTS
|
|
4216
|
+
];
|
|
4217
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4218
|
+
try {
|
|
4219
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4220
|
+
var candidate = _step.value;
|
|
4221
|
+
if (typeof candidate === "number" && Number.isFinite(candidate)) {
|
|
4222
|
+
return candidate;
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
} catch (err) {
|
|
4226
|
+
_didIteratorError = true;
|
|
4227
|
+
_iteratorError = err;
|
|
4228
|
+
} finally{
|
|
4229
|
+
try {
|
|
4230
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4231
|
+
_iterator.return();
|
|
4232
|
+
}
|
|
4233
|
+
} finally{
|
|
4234
|
+
if (_didIteratorError) {
|
|
4235
|
+
throw _iteratorError;
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
return void 0;
|
|
4240
|
+
}
|
|
4241
|
+
},
|
|
4242
|
+
{
|
|
4243
|
+
key: "onScte35Cue",
|
|
4244
|
+
value: function onScte35Cue(marker, context) {
|
|
4245
|
+
var cue = this.createScte35Cue(marker, context);
|
|
4246
|
+
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
4247
|
+
if (context.readiness === "early") {
|
|
4248
|
+
this.pendingScte35Cues.set(pendingKey, cue);
|
|
4249
|
+
this.trimRecentScte35CueMaps();
|
|
4250
|
+
if (marker.type === "start") {
|
|
4251
|
+
this.startAdPrefetch(marker, context.fragmentSn, cue.key);
|
|
4252
|
+
}
|
|
4253
|
+
return;
|
|
4254
|
+
}
|
|
4255
|
+
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
4256
|
+
if (this.config.debugAdTiming) {
|
|
4257
|
+
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
4258
|
+
key: cue.key,
|
|
4259
|
+
activeScte35BreakKey: this.activeScte35BreakKey,
|
|
4260
|
+
inAdBreak: this.inAdBreak,
|
|
4261
|
+
source: cue.source
|
|
4262
|
+
});
|
|
4263
|
+
}
|
|
4264
|
+
return;
|
|
4265
|
+
}
|
|
4266
|
+
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
4267
|
+
if (this.config.debugAdTiming) {
|
|
4268
|
+
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
4269
|
+
key: cue.key,
|
|
4270
|
+
source: cue.source
|
|
4271
|
+
});
|
|
4272
|
+
}
|
|
4273
|
+
return;
|
|
4274
|
+
}
|
|
4275
|
+
this.pendingScte35Cues.delete(pendingKey);
|
|
4276
|
+
this.markScte35CueHandled(cue);
|
|
4277
|
+
this.onScte35Marker(marker, cue.key);
|
|
4278
|
+
}
|
|
4279
|
+
},
|
|
4280
|
+
{
|
|
4281
|
+
key: "createScte35Cue",
|
|
4282
|
+
value: function createScte35Cue(marker, context) {
|
|
4283
|
+
var cue = {
|
|
4284
|
+
marker: marker,
|
|
4285
|
+
source: context.source,
|
|
4286
|
+
readiness: context.readiness,
|
|
4287
|
+
key: this.getScte35CueKey(marker, context)
|
|
4288
|
+
};
|
|
4289
|
+
if (context.fragmentSn !== void 0) {
|
|
4290
|
+
cue.fragmentSn = context.fragmentSn;
|
|
4291
|
+
}
|
|
4292
|
+
if (context.fragmentStartSeconds !== void 0) {
|
|
4293
|
+
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
4294
|
+
}
|
|
4295
|
+
return cue;
|
|
4296
|
+
}
|
|
4297
|
+
},
|
|
4298
|
+
{
|
|
4299
|
+
key: "getScte35CueKey",
|
|
4300
|
+
value: function getScte35CueKey(marker, context) {
|
|
4301
|
+
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
4302
|
+
var raw = this.getScte35MarkerRaw(marker);
|
|
4303
|
+
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
4304
|
+
if (spliceEventId) {
|
|
4305
|
+
return "splice:".concat(spliceEventId);
|
|
4306
|
+
}
|
|
4307
|
+
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
4308
|
+
if (segmentationEventId) {
|
|
4309
|
+
return "segmentation:".concat(segmentationEventId);
|
|
4310
|
+
}
|
|
4311
|
+
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);
|
|
4312
|
+
if (daterangeId) {
|
|
4313
|
+
return "daterange:".concat(daterangeId);
|
|
4314
|
+
}
|
|
4315
|
+
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"]);
|
|
4316
|
+
if (scteValue) {
|
|
4317
|
+
return "daterange-scte:".concat(scteValue);
|
|
4318
|
+
}
|
|
4319
|
+
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
4320
|
+
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
4321
|
+
}
|
|
4322
|
+
if (context.fragmentSn !== void 0) {
|
|
4323
|
+
return "fragment:".concat(context.fragmentSn);
|
|
4324
|
+
}
|
|
4325
|
+
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4326
|
+
}
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
key: "getPendingScte35CueKey",
|
|
4330
|
+
value: function getPendingScte35CueKey(cue) {
|
|
4331
|
+
return "".concat(cue.marker.type, ":").concat(cue.key, ":").concat(cue.fragmentSn !== void 0 ? cue.fragmentSn : "unknown");
|
|
4332
|
+
}
|
|
4333
|
+
},
|
|
4334
|
+
{
|
|
4335
|
+
key: "getScte35MarkerRaw",
|
|
4336
|
+
value: function getScte35MarkerRaw(marker) {
|
|
4337
|
+
return _type_of(marker.raw) === "object" && marker.raw !== null ? marker.raw : {};
|
|
4338
|
+
}
|
|
4339
|
+
},
|
|
4340
|
+
{
|
|
4341
|
+
key: "toIdentityString",
|
|
4342
|
+
value: function toIdentityString(value) {
|
|
4343
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4344
|
+
return String(value);
|
|
4345
|
+
}
|
|
4346
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
4347
|
+
return value.trim();
|
|
4348
|
+
}
|
|
4349
|
+
return void 0;
|
|
4350
|
+
}
|
|
4351
|
+
},
|
|
4352
|
+
{
|
|
4353
|
+
key: "isStrongScte35CueKey",
|
|
4354
|
+
value: function isStrongScte35CueKey(key) {
|
|
4355
|
+
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4356
|
+
}
|
|
4357
|
+
},
|
|
4358
|
+
{
|
|
4359
|
+
key: "hasRecentlyHandledScte35Cue",
|
|
4360
|
+
value: function hasRecentlyHandledScte35Cue(cue) {
|
|
4361
|
+
if (this.activeScte35BreakKey === cue.key || this.scheduledScte35BreakKey === cue.key) {
|
|
4362
|
+
return true;
|
|
4363
|
+
}
|
|
4364
|
+
var recentKey = "".concat(cue.marker.type, ":").concat(cue.key);
|
|
4365
|
+
return this.recentScte35CueKeys.has(recentKey);
|
|
4366
|
+
}
|
|
4367
|
+
},
|
|
4368
|
+
{
|
|
4369
|
+
key: "markScte35CueHandled",
|
|
4370
|
+
value: function markScte35CueHandled(cue) {
|
|
4371
|
+
this.recentScte35CueKeys.set("".concat(cue.marker.type, ":").concat(cue.key), Date.now());
|
|
4372
|
+
this.trimRecentScte35CueMaps();
|
|
4373
|
+
}
|
|
4374
|
+
},
|
|
4375
|
+
{
|
|
4376
|
+
key: "trimRecentScte35CueMaps",
|
|
4377
|
+
value: function trimRecentScte35CueMaps() {
|
|
4378
|
+
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
4379
|
+
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
4380
|
+
if (!firstKey) {
|
|
4381
|
+
break;
|
|
4382
|
+
}
|
|
4383
|
+
this.recentScte35CueKeys.delete(firstKey);
|
|
4384
|
+
}
|
|
4385
|
+
while(this.pendingScte35Cues.size > this.recentScte35CueLimit){
|
|
4386
|
+
var firstKey1 = this.pendingScte35Cues.keys().next().value;
|
|
4387
|
+
if (!firstKey1) {
|
|
4388
|
+
break;
|
|
4389
|
+
}
|
|
4390
|
+
this.pendingScte35Cues.delete(firstKey1);
|
|
4391
|
+
}
|
|
4392
|
+
}
|
|
4393
|
+
},
|
|
4394
|
+
{
|
|
4395
|
+
key: "shouldAcceptScte35EndCue",
|
|
4396
|
+
value: function shouldAcceptScte35EndCue(cue) {
|
|
4397
|
+
if (!this.inAdBreak) {
|
|
4398
|
+
return false;
|
|
4399
|
+
}
|
|
4400
|
+
if (this.isStrongScte35CueKey(this.activeScte35BreakKey) && this.isStrongScte35CueKey(cue.key) && this.activeScte35BreakKey !== cue.key) {
|
|
4401
|
+
return false;
|
|
4402
|
+
}
|
|
4403
|
+
return true;
|
|
4404
|
+
}
|
|
4405
|
+
},
|
|
4406
|
+
{
|
|
4407
|
+
key: "activatePendingScte35CuesForFragment",
|
|
4408
|
+
value: function activatePendingScte35CuesForFragment(frag) {
|
|
4409
|
+
var _this = this;
|
|
4410
|
+
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
4411
|
+
if (fragmentSn === void 0) {
|
|
4412
|
+
return;
|
|
4413
|
+
}
|
|
4414
|
+
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
4415
|
+
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
4416
|
+
return cue.fragmentSn === fragmentSn;
|
|
4417
|
+
});
|
|
4418
|
+
matchingCues.forEach(function(param) {
|
|
4419
|
+
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
4420
|
+
var _cue_fragmentStartSeconds;
|
|
4421
|
+
_this.pendingScte35Cues.delete(pendingKey);
|
|
4422
|
+
var context = {
|
|
4423
|
+
source: cue.source,
|
|
4424
|
+
readiness: "playback"
|
|
4425
|
+
};
|
|
4426
|
+
context.fragmentSn = fragmentSn;
|
|
4427
|
+
var fragmentStartSeconds = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : _this.getFragmentStartSeconds(frag);
|
|
4428
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4429
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4430
|
+
}
|
|
4431
|
+
_this.onScte35Cue(cue.marker, context);
|
|
4432
|
+
});
|
|
4433
|
+
}
|
|
4434
|
+
},
|
|
4172
4435
|
{
|
|
4173
4436
|
key: "onScte35Marker",
|
|
4174
|
-
value: function onScte35Marker(marker) {
|
|
4437
|
+
value: function onScte35Marker(marker, cueKey) {
|
|
4175
4438
|
if (this.config.debugAdTiming) {
|
|
4176
4439
|
console.log("[StormcloudVideoPlayer] SCTE-35 marker detected:", {
|
|
4177
4440
|
type: marker.type,
|
|
@@ -4185,13 +4448,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4185
4448
|
if (marker.type === "start") {
|
|
4186
4449
|
var _this_config_immediateManifestAds;
|
|
4187
4450
|
var _this_pendingAdBreak;
|
|
4188
|
-
if (!this.video.muted) {
|
|
4189
|
-
this.video.muted = true;
|
|
4190
|
-
this.video.volume = 0;
|
|
4191
|
-
if (this.config.debugAdTiming) {
|
|
4192
|
-
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4193
|
-
}
|
|
4194
|
-
}
|
|
4195
4451
|
if (this.inAdBreak) {
|
|
4196
4452
|
if (marker.durationSeconds != null) {
|
|
4197
4453
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
@@ -4215,10 +4471,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4215
4471
|
sendAdDetectTracking(this.config.licenseKey, detectPayload).catch(function() {});
|
|
4216
4472
|
}
|
|
4217
4473
|
var hasPrefetchedAds = this.pendingAdBreak && this.pendingAdBreak.vastUrls.length > 0;
|
|
4218
|
-
this.inAdBreak = true;
|
|
4219
4474
|
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;
|
|
4220
|
-
this.expectedAdBreakDurationMs = durationMs;
|
|
4221
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4222
4475
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
4223
4476
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
4224
4477
|
if (this.config.debugAdTiming) {
|
|
@@ -4234,7 +4487,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4234
4487
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (manifest-based)".concat(hasPrefetchedAds ? " with prefetched ads" : ""));
|
|
4235
4488
|
}
|
|
4236
4489
|
this.clearAdStartTimer();
|
|
4237
|
-
this.
|
|
4490
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4238
4491
|
} else if (typeof marker.ptsSeconds === "number") {
|
|
4239
4492
|
var _this_config_driftToleranceMs;
|
|
4240
4493
|
var tol = (_this_config_driftToleranceMs = this.config.driftToleranceMs) !== null && _this_config_driftToleranceMs !== void 0 ? _this_config_driftToleranceMs : 1e3;
|
|
@@ -4254,23 +4507,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4254
4507
|
if (this.config.debugAdTiming) {
|
|
4255
4508
|
console.log("[StormcloudVideoPlayer] Scheduling ad start in ".concat(deltaMs, "ms"));
|
|
4256
4509
|
}
|
|
4257
|
-
this.
|
|
4510
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4511
|
+
this.scheduledScte35BreakKey = cueKey;
|
|
4512
|
+
this.scheduleAdStartIn(deltaMs, marker, cueKey);
|
|
4258
4513
|
} else {
|
|
4259
4514
|
if (this.config.debugAdTiming) {
|
|
4260
4515
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (within tolerance)");
|
|
4261
4516
|
}
|
|
4262
4517
|
this.clearAdStartTimer();
|
|
4263
|
-
this.
|
|
4518
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4264
4519
|
}
|
|
4265
4520
|
} else {
|
|
4266
4521
|
if (this.config.debugAdTiming) {
|
|
4267
4522
|
console.log("[StormcloudVideoPlayer] Starting ad immediately (fallback)");
|
|
4268
4523
|
}
|
|
4269
4524
|
this.clearAdStartTimer();
|
|
4270
|
-
this.
|
|
4271
|
-
}
|
|
4272
|
-
if (this.expectedAdBreakDurationMs != null) {
|
|
4273
|
-
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4525
|
+
this.startScte35AdBreak(marker, cueKey, durationMs);
|
|
4274
4526
|
}
|
|
4275
4527
|
return;
|
|
4276
4528
|
}
|
|
@@ -4326,6 +4578,27 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4326
4578
|
}
|
|
4327
4579
|
}
|
|
4328
4580
|
},
|
|
4581
|
+
{
|
|
4582
|
+
key: "startScte35AdBreak",
|
|
4583
|
+
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4584
|
+
if (!this.video.muted) {
|
|
4585
|
+
this.video.muted = true;
|
|
4586
|
+
this.video.volume = 0;
|
|
4587
|
+
if (this.config.debugAdTiming) {
|
|
4588
|
+
console.log("[StormcloudVideoPlayer] Muted video on SCTE start marker");
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
this.inAdBreak = true;
|
|
4592
|
+
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4593
|
+
this.scheduledScte35BreakKey = void 0;
|
|
4594
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4595
|
+
this.currentAdBreakStartWallClockMs = Date.now();
|
|
4596
|
+
this.handleAdStart(marker);
|
|
4597
|
+
if (this.expectedAdBreakDurationMs != null) {
|
|
4598
|
+
this.scheduleAdStopCountdown(this.expectedAdBreakDurationMs);
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
},
|
|
4329
4602
|
{
|
|
4330
4603
|
key: "parseCueOutDuration",
|
|
4331
4604
|
value: function parseCueOutDuration(value) {
|
|
@@ -4409,6 +4682,336 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4409
4682
|
return false;
|
|
4410
4683
|
}
|
|
4411
4684
|
},
|
|
4685
|
+
{
|
|
4686
|
+
key: "normalizeFragmentPayload",
|
|
4687
|
+
value: function normalizeFragmentPayload(payload) {
|
|
4688
|
+
if (_instanceof(payload, Uint8Array)) {
|
|
4689
|
+
return payload;
|
|
4690
|
+
}
|
|
4691
|
+
if (_instanceof(payload, ArrayBuffer)) {
|
|
4692
|
+
return new Uint8Array(payload);
|
|
4693
|
+
}
|
|
4694
|
+
if (ArrayBuffer.isView(payload)) {
|
|
4695
|
+
var view = payload;
|
|
4696
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
4697
|
+
}
|
|
4698
|
+
return void 0;
|
|
4699
|
+
}
|
|
4700
|
+
},
|
|
4701
|
+
{
|
|
4702
|
+
key: "processFragmentScte35Payload",
|
|
4703
|
+
value: function processFragmentScte35Payload(payloadData, fragmentSn, fragmentStartSeconds) {
|
|
4704
|
+
var _this = this;
|
|
4705
|
+
var payload = this.normalizeFragmentPayload(payloadData);
|
|
4706
|
+
if (!payload) {
|
|
4707
|
+
return;
|
|
4708
|
+
}
|
|
4709
|
+
var markers = this.parseScte35FromTsPackets(payload);
|
|
4710
|
+
markers.forEach(function(marker) {
|
|
4711
|
+
var context = {
|
|
4712
|
+
source: "ts",
|
|
4713
|
+
readiness: "early"
|
|
4714
|
+
};
|
|
4715
|
+
if (fragmentSn !== void 0) {
|
|
4716
|
+
context.fragmentSn = fragmentSn;
|
|
4717
|
+
}
|
|
4718
|
+
if (fragmentStartSeconds !== void 0) {
|
|
4719
|
+
context.fragmentStartSeconds = fragmentStartSeconds;
|
|
4720
|
+
}
|
|
4721
|
+
_this.onScte35Cue(marker, context);
|
|
4722
|
+
});
|
|
4723
|
+
}
|
|
4724
|
+
},
|
|
4725
|
+
{
|
|
4726
|
+
key: "parseScte35FromTsPackets",
|
|
4727
|
+
value: function parseScte35FromTsPackets(data) {
|
|
4728
|
+
var packetInfo = this.detectTsPacketFormat(data);
|
|
4729
|
+
if (!packetInfo) {
|
|
4730
|
+
return [];
|
|
4731
|
+
}
|
|
4732
|
+
var markers = [];
|
|
4733
|
+
var sectionAssemblers = /* @__PURE__ */ new Map();
|
|
4734
|
+
for(var packetStart = packetInfo.offset; packetStart + packetInfo.packetSize <= data.length; packetStart += packetInfo.packetSize){
|
|
4735
|
+
var tsStart = packetStart + packetInfo.tsPayloadOffset;
|
|
4736
|
+
if (data[tsStart] !== 71) {
|
|
4737
|
+
continue;
|
|
4738
|
+
}
|
|
4739
|
+
var secondByte = data[tsStart + 1];
|
|
4740
|
+
var thirdByte = data[tsStart + 2];
|
|
4741
|
+
var fourthByte = data[tsStart + 3];
|
|
4742
|
+
if (secondByte == null || thirdByte == null || fourthByte == null || (secondByte & 128) !== 0) {
|
|
4743
|
+
continue;
|
|
4744
|
+
}
|
|
4745
|
+
var payloadUnitStart = (secondByte & 64) !== 0;
|
|
4746
|
+
var pid = (secondByte & 31) << 8 | thirdByte;
|
|
4747
|
+
var adaptationFieldControl = fourthByte >> 4 & 3;
|
|
4748
|
+
var hasPayload = adaptationFieldControl === 1 || adaptationFieldControl === 3;
|
|
4749
|
+
if (!hasPayload) {
|
|
4750
|
+
continue;
|
|
4751
|
+
}
|
|
4752
|
+
var payloadStart = tsStart + 4;
|
|
4753
|
+
if (adaptationFieldControl === 3) {
|
|
4754
|
+
var adaptationLength = data[payloadStart];
|
|
4755
|
+
if (adaptationLength == null) {
|
|
4756
|
+
continue;
|
|
4757
|
+
}
|
|
4758
|
+
payloadStart += 1 + adaptationLength;
|
|
4759
|
+
}
|
|
4760
|
+
var payloadEnd = Math.min(tsStart + 188, data.length);
|
|
4761
|
+
if (payloadStart >= payloadEnd || payloadStart >= data.length) {
|
|
4762
|
+
continue;
|
|
4763
|
+
}
|
|
4764
|
+
var payload = data.subarray(payloadStart, payloadEnd);
|
|
4765
|
+
if (pid === 0) {
|
|
4766
|
+
this.parsePatSection(payload, payloadUnitStart);
|
|
4767
|
+
} else if (this.pmtPids.has(pid)) {
|
|
4768
|
+
this.parsePmtSection(payload, payloadUnitStart);
|
|
4769
|
+
} else if (this.tsScte35Pids.has(pid)) {
|
|
4770
|
+
this.collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, sectionAssemblers, markers);
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
return markers;
|
|
4774
|
+
}
|
|
4775
|
+
},
|
|
4776
|
+
{
|
|
4777
|
+
key: "detectTsPacketFormat",
|
|
4778
|
+
value: function detectTsPacketFormat(data) {
|
|
4779
|
+
var packetSizes = [
|
|
4780
|
+
188,
|
|
4781
|
+
192,
|
|
4782
|
+
204
|
|
4783
|
+
];
|
|
4784
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4785
|
+
try {
|
|
4786
|
+
for(var _iterator = packetSizes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4787
|
+
var packetSize = _step.value;
|
|
4788
|
+
var tsPayloadOffset = packetSize === 192 ? 4 : 0;
|
|
4789
|
+
for(var offset = 0; offset < packetSize; offset++){
|
|
4790
|
+
var matchedPackets = 0;
|
|
4791
|
+
for(var packetStart = offset; packetStart + tsPayloadOffset < data.length && matchedPackets < 5; packetStart += packetSize){
|
|
4792
|
+
if (data[packetStart + tsPayloadOffset] !== 71) {
|
|
4793
|
+
break;
|
|
4794
|
+
}
|
|
4795
|
+
matchedPackets++;
|
|
4796
|
+
}
|
|
4797
|
+
if (matchedPackets >= 2) {
|
|
4798
|
+
return {
|
|
4799
|
+
offset: offset,
|
|
4800
|
+
packetSize: packetSize,
|
|
4801
|
+
tsPayloadOffset: tsPayloadOffset
|
|
4802
|
+
};
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
} catch (err) {
|
|
4807
|
+
_didIteratorError = true;
|
|
4808
|
+
_iteratorError = err;
|
|
4809
|
+
} finally{
|
|
4810
|
+
try {
|
|
4811
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4812
|
+
_iterator.return();
|
|
4813
|
+
}
|
|
4814
|
+
} finally{
|
|
4815
|
+
if (_didIteratorError) {
|
|
4816
|
+
throw _iteratorError;
|
|
4817
|
+
}
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
return void 0;
|
|
4821
|
+
}
|
|
4822
|
+
},
|
|
4823
|
+
{
|
|
4824
|
+
key: "parsePatSection",
|
|
4825
|
+
value: function parsePatSection(payload, payloadUnitStart) {
|
|
4826
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4827
|
+
if (sectionStart == null || sectionStart + 8 >= payload.length) {
|
|
4828
|
+
return;
|
|
4829
|
+
}
|
|
4830
|
+
if (payload[sectionStart] !== 0) {
|
|
4831
|
+
return;
|
|
4832
|
+
}
|
|
4833
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4834
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4835
|
+
for(var offset = sectionStart + 8; offset + 4 <= sectionEnd - 4; offset += 4){
|
|
4836
|
+
var _payload_offset, _payload_, _payload_1, _payload_2;
|
|
4837
|
+
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);
|
|
4838
|
+
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);
|
|
4839
|
+
if (programNumber !== 0) {
|
|
4840
|
+
this.pmtPids.add(pid);
|
|
4841
|
+
}
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
},
|
|
4845
|
+
{
|
|
4846
|
+
key: "parsePmtSection",
|
|
4847
|
+
value: function parsePmtSection(payload, payloadUnitStart) {
|
|
4848
|
+
var _payload_, _payload_1;
|
|
4849
|
+
var sectionStart = this.getPsiSectionStart(payload, payloadUnitStart);
|
|
4850
|
+
if (sectionStart == null || sectionStart + 12 >= payload.length) {
|
|
4851
|
+
return;
|
|
4852
|
+
}
|
|
4853
|
+
if (payload[sectionStart] !== 2) {
|
|
4854
|
+
return;
|
|
4855
|
+
}
|
|
4856
|
+
var sectionLength = this.getPsiSectionLength(payload, sectionStart);
|
|
4857
|
+
var sectionEnd = Math.min(payload.length, sectionStart + 3 + sectionLength);
|
|
4858
|
+
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);
|
|
4859
|
+
var offset = sectionStart + 12 + programInfoLength;
|
|
4860
|
+
while(offset + 5 <= sectionEnd - 4){
|
|
4861
|
+
var _payload_offset, _payload_2, _payload_3, _payload_4, _payload_5;
|
|
4862
|
+
var streamType = (_payload_offset = payload[offset]) !== null && _payload_offset !== void 0 ? _payload_offset : 0;
|
|
4863
|
+
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);
|
|
4864
|
+
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);
|
|
4865
|
+
var descriptorStart = offset + 5;
|
|
4866
|
+
var descriptorEnd = Math.min(descriptorStart + esInfoLength, sectionEnd - 4);
|
|
4867
|
+
if (streamType === 134 || streamType === 6 && this.descriptorsIdentifyScte35(payload, descriptorStart, descriptorEnd)) {
|
|
4868
|
+
this.tsScte35Pids.add(elementaryPid);
|
|
4869
|
+
}
|
|
4870
|
+
offset = descriptorStart + esInfoLength;
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
},
|
|
4874
|
+
{
|
|
4875
|
+
key: "descriptorsIdentifyScte35",
|
|
4876
|
+
value: function descriptorsIdentifyScte35(data, start, end) {
|
|
4877
|
+
var offset = start;
|
|
4878
|
+
while(offset + 2 <= end){
|
|
4879
|
+
var _data_offset, _data_, _data_descriptorStart, _data_1, _data_2, _data_3;
|
|
4880
|
+
var tag = (_data_offset = data[offset]) !== null && _data_offset !== void 0 ? _data_offset : 0;
|
|
4881
|
+
var length = (_data_ = data[offset + 1]) !== null && _data_ !== void 0 ? _data_ : 0;
|
|
4882
|
+
var descriptorStart = offset + 2;
|
|
4883
|
+
var descriptorEnd = descriptorStart + length;
|
|
4884
|
+
if (descriptorEnd > end) {
|
|
4885
|
+
return false;
|
|
4886
|
+
}
|
|
4887
|
+
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) : "";
|
|
4888
|
+
if (tag === 138 || registration === "CUEI" || registration === "SCTE") {
|
|
4889
|
+
return true;
|
|
4890
|
+
}
|
|
4891
|
+
offset = descriptorEnd;
|
|
4892
|
+
}
|
|
4893
|
+
return false;
|
|
4894
|
+
}
|
|
4895
|
+
},
|
|
4896
|
+
{
|
|
4897
|
+
key: "collectScte35SectionsFromPayload",
|
|
4898
|
+
value: function collectScte35SectionsFromPayload(pid, payload, payloadUnitStart, assemblers, markers) {
|
|
4899
|
+
if (payload.length === 0) {
|
|
4900
|
+
return;
|
|
4901
|
+
}
|
|
4902
|
+
var offset = 0;
|
|
4903
|
+
if (payloadUnitStart) {
|
|
4904
|
+
var _payload_;
|
|
4905
|
+
var pointerField = (_payload_ = payload[0]) !== null && _payload_ !== void 0 ? _payload_ : 0;
|
|
4906
|
+
var previousAssembler = assemblers.get(pid);
|
|
4907
|
+
if (previousAssembler && pointerField > 0) {
|
|
4908
|
+
this.appendScte35Bytes(pid, payload.subarray(1, Math.min(1 + pointerField, payload.length)), assemblers, markers);
|
|
4909
|
+
}
|
|
4910
|
+
assemblers.delete(pid);
|
|
4911
|
+
offset = 1 + pointerField;
|
|
4912
|
+
} else {
|
|
4913
|
+
this.appendScte35Bytes(pid, payload, assemblers, markers);
|
|
4914
|
+
return;
|
|
4915
|
+
}
|
|
4916
|
+
while(offset + 3 <= payload.length){
|
|
4917
|
+
var tableId = payload[offset];
|
|
4918
|
+
if (tableId == null || tableId === 255) {
|
|
4919
|
+
return;
|
|
4920
|
+
}
|
|
4921
|
+
var sectionLength = this.getPsiSectionLength(payload, offset);
|
|
4922
|
+
var totalLength = 3 + sectionLength;
|
|
4923
|
+
if (sectionLength <= 0 || totalLength <= 3) {
|
|
4924
|
+
return;
|
|
4925
|
+
}
|
|
4926
|
+
if (offset + totalLength <= payload.length) {
|
|
4927
|
+
this.addScte35SectionMarker(payload.subarray(offset, offset + totalLength), markers);
|
|
4928
|
+
offset += totalLength;
|
|
4929
|
+
} else {
|
|
4930
|
+
assemblers.set(pid, {
|
|
4931
|
+
bytes: Array.from(payload.subarray(offset)),
|
|
4932
|
+
expectedLength: totalLength
|
|
4933
|
+
});
|
|
4934
|
+
return;
|
|
4935
|
+
}
|
|
4936
|
+
}
|
|
4937
|
+
}
|
|
4938
|
+
},
|
|
4939
|
+
{
|
|
4940
|
+
key: "appendScte35Bytes",
|
|
4941
|
+
value: function appendScte35Bytes(pid, bytes, assemblers, markers) {
|
|
4942
|
+
var assembler = assemblers.get(pid);
|
|
4943
|
+
if (!assembler) {
|
|
4944
|
+
return;
|
|
4945
|
+
}
|
|
4946
|
+
for(var i = 0; i < bytes.length && assembler.bytes.length < assembler.expectedLength; i++){
|
|
4947
|
+
var _bytes_i;
|
|
4948
|
+
assembler.bytes.push((_bytes_i = bytes[i]) !== null && _bytes_i !== void 0 ? _bytes_i : 0);
|
|
4949
|
+
}
|
|
4950
|
+
if (assembler.bytes.length >= assembler.expectedLength) {
|
|
4951
|
+
assemblers.delete(pid);
|
|
4952
|
+
this.addScte35SectionMarker(new Uint8Array(assembler.bytes), markers);
|
|
4953
|
+
}
|
|
4954
|
+
}
|
|
4955
|
+
},
|
|
4956
|
+
{
|
|
4957
|
+
key: "addScte35SectionMarker",
|
|
4958
|
+
value: function addScte35SectionMarker(section, markers) {
|
|
4959
|
+
if (section[0] !== 252 || this.hasProcessedTsScte35Section(section)) {
|
|
4960
|
+
return;
|
|
4961
|
+
}
|
|
4962
|
+
var marker = this.parseScte35Binary(section);
|
|
4963
|
+
if (!marker) {
|
|
4964
|
+
return;
|
|
4965
|
+
}
|
|
4966
|
+
marker.raw = _object_spread_props(_object_spread({}, _type_of(marker.raw) === "object" && marker.raw ? marker.raw : {}), {
|
|
4967
|
+
source: "ts-packet"
|
|
4968
|
+
});
|
|
4969
|
+
markers.push(marker);
|
|
4970
|
+
}
|
|
4971
|
+
},
|
|
4972
|
+
{
|
|
4973
|
+
key: "hasProcessedTsScte35Section",
|
|
4974
|
+
value: function hasProcessedTsScte35Section(section) {
|
|
4975
|
+
var checksum = 0;
|
|
4976
|
+
for(var i = 0; i < section.length; i++){
|
|
4977
|
+
var _section_i;
|
|
4978
|
+
checksum = checksum * 31 + ((_section_i = section[i]) !== null && _section_i !== void 0 ? _section_i : 0) >>> 0;
|
|
4979
|
+
}
|
|
4980
|
+
var key = "".concat(section.length, ":").concat(checksum);
|
|
4981
|
+
if (this.processedTsScte35Sections.has(key)) {
|
|
4982
|
+
return true;
|
|
4983
|
+
}
|
|
4984
|
+
this.processedTsScte35Sections.add(key);
|
|
4985
|
+
if (this.processedTsScte35Sections.size > 200) {
|
|
4986
|
+
var firstKey = this.processedTsScte35Sections.values().next().value;
|
|
4987
|
+
if (firstKey) {
|
|
4988
|
+
this.processedTsScte35Sections.delete(firstKey);
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
return false;
|
|
4992
|
+
}
|
|
4993
|
+
},
|
|
4994
|
+
{
|
|
4995
|
+
key: "getPsiSectionStart",
|
|
4996
|
+
value: function getPsiSectionStart(payload, payloadUnitStart) {
|
|
4997
|
+
if (!payloadUnitStart) {
|
|
4998
|
+
return void 0;
|
|
4999
|
+
}
|
|
5000
|
+
var pointerField = payload[0];
|
|
5001
|
+
if (pointerField == null) {
|
|
5002
|
+
return void 0;
|
|
5003
|
+
}
|
|
5004
|
+
var sectionStart = 1 + pointerField;
|
|
5005
|
+
return sectionStart < payload.length ? sectionStart : void 0;
|
|
5006
|
+
}
|
|
5007
|
+
},
|
|
5008
|
+
{
|
|
5009
|
+
key: "getPsiSectionLength",
|
|
5010
|
+
value: function getPsiSectionLength(data, offset) {
|
|
5011
|
+
var _data_, _data_1;
|
|
5012
|
+
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);
|
|
5013
|
+
}
|
|
5014
|
+
},
|
|
4412
5015
|
{
|
|
4413
5016
|
key: "parseScte35Binary",
|
|
4414
5017
|
value: function parseScte35Binary(data) {
|
|
@@ -4448,10 +5051,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4448
5051
|
value: function skipBits(n) {
|
|
4449
5052
|
this.readBits(n);
|
|
4450
5053
|
}
|
|
5054
|
+
},
|
|
5055
|
+
{
|
|
5056
|
+
key: "bytePosition",
|
|
5057
|
+
get: function get() {
|
|
5058
|
+
return this.bitPos === 0 ? this.bytePos : this.bytePos + 1;
|
|
5059
|
+
}
|
|
4451
5060
|
}
|
|
4452
5061
|
]);
|
|
4453
5062
|
return BitReader;
|
|
4454
5063
|
}();
|
|
5064
|
+
var readSpliceTime = function readSpliceTime(r2, ptsAdjustmentTicks2) {
|
|
5065
|
+
var timeSpecifiedFlag = r2.readBits(1) === 1;
|
|
5066
|
+
if (!timeSpecifiedFlag) {
|
|
5067
|
+
r2.readBits(7);
|
|
5068
|
+
return void 0;
|
|
5069
|
+
}
|
|
5070
|
+
r2.readBits(6);
|
|
5071
|
+
var high = r2.readBits(1);
|
|
5072
|
+
var low = r2.readBits(32);
|
|
5073
|
+
var ptsTicks = (high * 4294967296 + low + ptsAdjustmentTicks2) % 8589934592;
|
|
5074
|
+
return ptsTicks / 9e4;
|
|
5075
|
+
};
|
|
4455
5076
|
var r = new BitReader(data);
|
|
4456
5077
|
var tableId = r.readBits(8);
|
|
4457
5078
|
if (tableId !== 252) return void 0;
|
|
@@ -4459,77 +5080,206 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4459
5080
|
r.readBits(1);
|
|
4460
5081
|
r.readBits(2);
|
|
4461
5082
|
var sectionLength = r.readBits(12);
|
|
5083
|
+
if (sectionLength <= 0 || data.length < 3 + sectionLength) {
|
|
5084
|
+
return void 0;
|
|
5085
|
+
}
|
|
4462
5086
|
r.readBits(8);
|
|
4463
5087
|
r.readBits(1);
|
|
4464
5088
|
r.readBits(6);
|
|
4465
5089
|
var ptsAdjHigh = r.readBits(1);
|
|
4466
5090
|
var ptsAdjLow = r.readBits(32);
|
|
4467
|
-
|
|
4468
|
-
void ptsAdjLow;
|
|
5091
|
+
var ptsAdjustmentTicks = ptsAdjHigh * 4294967296 + ptsAdjLow;
|
|
4469
5092
|
r.readBits(8);
|
|
4470
5093
|
r.readBits(12);
|
|
4471
5094
|
var spliceCommandLength = r.readBits(12);
|
|
4472
5095
|
var spliceCommandType = r.readBits(8);
|
|
4473
|
-
|
|
5096
|
+
var markerType;
|
|
5097
|
+
var durationSeconds = void 0;
|
|
5098
|
+
var ptsSeconds = void 0;
|
|
5099
|
+
var spliceEventId = void 0;
|
|
5100
|
+
var commandBodyStart = r.bytePosition;
|
|
5101
|
+
if (spliceCommandType === 5) {
|
|
5102
|
+
spliceEventId = r.readBits(32);
|
|
5103
|
+
var cancel = r.readBits(1) === 1;
|
|
5104
|
+
r.readBits(7);
|
|
5105
|
+
if (cancel) return void 0;
|
|
5106
|
+
var outOfNetwork = r.readBits(1) === 1;
|
|
5107
|
+
var programSpliceFlag = r.readBits(1) === 1;
|
|
5108
|
+
var durationFlag = r.readBits(1) === 1;
|
|
5109
|
+
var spliceImmediateFlag = r.readBits(1) === 1;
|
|
5110
|
+
r.readBits(4);
|
|
5111
|
+
markerType = outOfNetwork ? "start" : "end";
|
|
5112
|
+
if (programSpliceFlag && !spliceImmediateFlag) {
|
|
5113
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5114
|
+
} else if (!programSpliceFlag) {
|
|
5115
|
+
var componentCount = r.readBits(8);
|
|
5116
|
+
for(var i = 0; i < componentCount; i++){
|
|
5117
|
+
r.readBits(8);
|
|
5118
|
+
if (!spliceImmediateFlag) {
|
|
5119
|
+
var componentPtsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5120
|
+
if (ptsSeconds === void 0) {
|
|
5121
|
+
ptsSeconds = componentPtsSeconds;
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
}
|
|
5125
|
+
}
|
|
5126
|
+
if (durationFlag) {
|
|
5127
|
+
r.readBits(6);
|
|
5128
|
+
r.readBits(1);
|
|
5129
|
+
var high = r.readBits(1);
|
|
5130
|
+
var low = r.readBits(32);
|
|
5131
|
+
var durationTicks = high * 4294967296 + low;
|
|
5132
|
+
durationSeconds = durationTicks / 9e4;
|
|
5133
|
+
}
|
|
5134
|
+
r.readBits(16);
|
|
5135
|
+
r.readBits(8);
|
|
5136
|
+
r.readBits(8);
|
|
5137
|
+
} else if (spliceCommandType === 6) {
|
|
5138
|
+
ptsSeconds = readSpliceTime(r, ptsAdjustmentTicks);
|
|
5139
|
+
} else {
|
|
4474
5140
|
return void 0;
|
|
4475
5141
|
}
|
|
4476
|
-
r.
|
|
4477
|
-
var
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
}
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
5142
|
+
var expectedDescriptorOffset = spliceCommandLength === 4095 ? r.bytePosition : commandBodyStart + spliceCommandLength;
|
|
5143
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptors(data, expectedDescriptorOffset);
|
|
5144
|
+
if (descriptorMarker) {
|
|
5145
|
+
markerType = descriptorMarker.type;
|
|
5146
|
+
if (durationSeconds === void 0) {
|
|
5147
|
+
durationSeconds = descriptorMarker.durationSeconds;
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
5150
|
+
if (!markerType) {
|
|
5151
|
+
return void 0;
|
|
5152
|
+
}
|
|
5153
|
+
var marker = _object_spread_props(_object_spread({
|
|
5154
|
+
type: markerType
|
|
5155
|
+
}, ptsSeconds !== void 0 ? {
|
|
5156
|
+
ptsSeconds: ptsSeconds
|
|
5157
|
+
} : {}, durationSeconds !== void 0 ? {
|
|
5158
|
+
durationSeconds: durationSeconds
|
|
5159
|
+
} : {}), {
|
|
5160
|
+
raw: _object_spread({
|
|
5161
|
+
splice_command_type: spliceCommandType
|
|
5162
|
+
}, spliceEventId !== void 0 ? {
|
|
5163
|
+
splice_event_id: spliceEventId
|
|
5164
|
+
} : {}, (descriptorMarker === null || descriptorMarker === void 0 ? void 0 : descriptorMarker.segmentationEventId) !== void 0 ? {
|
|
5165
|
+
segmentation_event_id: descriptorMarker.segmentationEventId
|
|
5166
|
+
} : {})
|
|
5167
|
+
});
|
|
5168
|
+
return marker;
|
|
5169
|
+
}
|
|
5170
|
+
},
|
|
5171
|
+
{
|
|
5172
|
+
key: "parseScte35SegmentationDescriptors",
|
|
5173
|
+
value: function parseScte35SegmentationDescriptors(data, offset) {
|
|
5174
|
+
var _data_offset, _data_;
|
|
5175
|
+
if (offset + 2 > data.length) {
|
|
5176
|
+
return void 0;
|
|
5177
|
+
}
|
|
5178
|
+
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);
|
|
5179
|
+
var descriptorOffset = offset + 2;
|
|
5180
|
+
var descriptorEnd = Math.min(data.length, descriptorOffset + descriptorLoopLength);
|
|
5181
|
+
while(descriptorOffset + 2 <= descriptorEnd){
|
|
5182
|
+
var _data_descriptorOffset, _data_1;
|
|
5183
|
+
var descriptorTag = (_data_descriptorOffset = data[descriptorOffset]) !== null && _data_descriptorOffset !== void 0 ? _data_descriptorOffset : 0;
|
|
5184
|
+
var descriptorLength = (_data_1 = data[descriptorOffset + 1]) !== null && _data_1 !== void 0 ? _data_1 : 0;
|
|
5185
|
+
var descriptorDataStart = descriptorOffset + 2;
|
|
5186
|
+
var descriptorDataEnd = descriptorDataStart + descriptorLength;
|
|
5187
|
+
if (descriptorDataEnd > descriptorEnd) {
|
|
5188
|
+
return void 0;
|
|
5189
|
+
}
|
|
5190
|
+
if (descriptorTag === 2) {
|
|
5191
|
+
var descriptorMarker = this.parseScte35SegmentationDescriptor(data.subarray(descriptorDataStart, descriptorDataEnd));
|
|
5192
|
+
if (descriptorMarker) {
|
|
5193
|
+
return descriptorMarker;
|
|
4505
5194
|
}
|
|
4506
5195
|
}
|
|
5196
|
+
descriptorOffset = descriptorDataEnd;
|
|
5197
|
+
}
|
|
5198
|
+
return void 0;
|
|
5199
|
+
}
|
|
5200
|
+
},
|
|
5201
|
+
{
|
|
5202
|
+
key: "parseScte35SegmentationDescriptor",
|
|
5203
|
+
value: function parseScte35SegmentationDescriptor(descriptor) {
|
|
5204
|
+
var _descriptor_, _descriptor_1, _descriptor_2, _descriptor_3, _descriptor_4, _descriptor_5, _descriptor_6, _descriptor_7, _descriptor_8, _descriptor_9, _descriptor_offset, _descriptor_offset1;
|
|
5205
|
+
if (descriptor.length < 11) {
|
|
5206
|
+
return void 0;
|
|
5207
|
+
}
|
|
5208
|
+
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);
|
|
5209
|
+
if (identifier !== "CUEI") {
|
|
5210
|
+
return void 0;
|
|
5211
|
+
}
|
|
5212
|
+
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);
|
|
5213
|
+
var cancelIndicator = (((_descriptor_8 = descriptor[8]) !== null && _descriptor_8 !== void 0 ? _descriptor_8 : 0) & 128) !== 0;
|
|
5214
|
+
if (cancelIndicator) {
|
|
5215
|
+
return void 0;
|
|
5216
|
+
}
|
|
5217
|
+
var flags = (_descriptor_9 = descriptor[9]) !== null && _descriptor_9 !== void 0 ? _descriptor_9 : 0;
|
|
5218
|
+
var programSegmentationFlag = (flags & 128) !== 0;
|
|
5219
|
+
var segmentationDurationFlag = (flags & 64) !== 0;
|
|
5220
|
+
var offset = 10;
|
|
5221
|
+
if (!programSegmentationFlag) {
|
|
5222
|
+
var _descriptor_offset2;
|
|
5223
|
+
var componentCount = (_descriptor_offset2 = descriptor[offset]) !== null && _descriptor_offset2 !== void 0 ? _descriptor_offset2 : 0;
|
|
5224
|
+
offset += 1 + componentCount * 6;
|
|
5225
|
+
if (offset > descriptor.length) {
|
|
5226
|
+
return void 0;
|
|
5227
|
+
}
|
|
4507
5228
|
}
|
|
4508
5229
|
var durationSeconds = void 0;
|
|
4509
|
-
if (
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
var durationTicks =
|
|
5230
|
+
if (segmentationDurationFlag) {
|
|
5231
|
+
var _descriptor_offset3, _descriptor_10, _descriptor_11, _descriptor_12, _descriptor_13;
|
|
5232
|
+
if (offset + 5 > descriptor.length) {
|
|
5233
|
+
return void 0;
|
|
5234
|
+
}
|
|
5235
|
+
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);
|
|
4515
5236
|
durationSeconds = durationTicks / 9e4;
|
|
5237
|
+
offset += 5;
|
|
4516
5238
|
}
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
5239
|
+
if (offset + 2 > descriptor.length) {
|
|
5240
|
+
return void 0;
|
|
5241
|
+
}
|
|
5242
|
+
offset += 1;
|
|
5243
|
+
var segmentationUpidLength = (_descriptor_offset = descriptor[offset]) !== null && _descriptor_offset !== void 0 ? _descriptor_offset : 0;
|
|
5244
|
+
offset += 1 + segmentationUpidLength;
|
|
5245
|
+
if (offset >= descriptor.length) {
|
|
5246
|
+
return void 0;
|
|
5247
|
+
}
|
|
5248
|
+
var segmentationTypeId = (_descriptor_offset1 = descriptor[offset]) !== null && _descriptor_offset1 !== void 0 ? _descriptor_offset1 : 0;
|
|
5249
|
+
var markerType = this.markerTypeFromSegmentationTypeId(segmentationTypeId);
|
|
5250
|
+
if (!markerType) {
|
|
5251
|
+
return void 0;
|
|
5252
|
+
}
|
|
5253
|
+
return _object_spread_props(_object_spread({
|
|
5254
|
+
type: markerType
|
|
5255
|
+
}, durationSeconds !== void 0 ? {
|
|
5256
|
+
durationSeconds: durationSeconds
|
|
5257
|
+
} : {}), {
|
|
5258
|
+
segmentationEventId: segmentationEventId
|
|
5259
|
+
});
|
|
5260
|
+
}
|
|
5261
|
+
},
|
|
5262
|
+
{
|
|
5263
|
+
key: "markerTypeFromSegmentationTypeId",
|
|
5264
|
+
value: function markerTypeFromSegmentationTypeId(segmentationTypeId) {
|
|
5265
|
+
switch(segmentationTypeId){
|
|
5266
|
+
case 16:
|
|
5267
|
+
case 34:
|
|
5268
|
+
case 48:
|
|
5269
|
+
case 50:
|
|
5270
|
+
case 52:
|
|
5271
|
+
case 54:
|
|
5272
|
+
return "start";
|
|
5273
|
+
case 17:
|
|
5274
|
+
case 35:
|
|
5275
|
+
case 49:
|
|
5276
|
+
case 51:
|
|
5277
|
+
case 53:
|
|
5278
|
+
case 55:
|
|
5279
|
+
return "end";
|
|
5280
|
+
default:
|
|
5281
|
+
return void 0;
|
|
4531
5282
|
}
|
|
4532
|
-
return void 0;
|
|
4533
5283
|
}
|
|
4534
5284
|
},
|
|
4535
5285
|
{
|
|
@@ -4926,7 +5676,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4926
5676
|
},
|
|
4927
5677
|
{
|
|
4928
5678
|
key: "startAdPrefetch",
|
|
4929
|
-
value: function startAdPrefetch(marker, fragmentSn) {
|
|
5679
|
+
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
4930
5680
|
if (this.pendingAdBreak || this.inAdBreak) {
|
|
4931
5681
|
return;
|
|
4932
5682
|
}
|
|
@@ -4954,6 +5704,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4954
5704
|
isFetching: false,
|
|
4955
5705
|
fetchStartTime: Date.now()
|
|
4956
5706
|
});
|
|
5707
|
+
this.pendingScte35CueKey = cueKey;
|
|
4957
5708
|
this.adDetectSentForCurrentBreak = true;
|
|
4958
5709
|
var detectPayload = {};
|
|
4959
5710
|
if (marker.durationSeconds != null) detectPayload.durationSeconds = marker.durationSeconds;
|
|
@@ -4975,6 +5726,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4975
5726
|
this.prefetchTimerId = void 0;
|
|
4976
5727
|
}
|
|
4977
5728
|
this.pendingAdBreak = null;
|
|
5729
|
+
this.pendingScte35CueKey = void 0;
|
|
4978
5730
|
}
|
|
4979
5731
|
},
|
|
4980
5732
|
{
|
|
@@ -6458,18 +7210,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6458
7210
|
key: "scheduleAdStartIn",
|
|
6459
7211
|
value: function scheduleAdStartIn(delayMs) {
|
|
6460
7212
|
var _this = this;
|
|
7213
|
+
var marker = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7214
|
+
type: "start"
|
|
7215
|
+
}, cueKey = arguments.length > 2 ? arguments[2] : void 0;
|
|
6461
7216
|
this.clearAdStartTimer();
|
|
6462
7217
|
var ms = Math.max(0, Math.floor(delayMs));
|
|
6463
7218
|
if (ms === 0) {
|
|
6464
|
-
this.
|
|
6465
|
-
type: "start"
|
|
6466
|
-
}).catch(function() {});
|
|
7219
|
+
this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0);
|
|
6467
7220
|
return;
|
|
6468
7221
|
}
|
|
6469
7222
|
this.adStartTimerId = window.setTimeout(function() {
|
|
6470
|
-
_this.
|
|
6471
|
-
type: "start"
|
|
6472
|
-
}).catch(function() {});
|
|
7223
|
+
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.expectedAdBreakDurationMs);
|
|
6473
7224
|
}, ms);
|
|
6474
7225
|
}
|
|
6475
7226
|
},
|
|
@@ -6900,6 +7651,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6900
7651
|
this.adRequestQueue = [];
|
|
6901
7652
|
this.inAdBreak = false;
|
|
6902
7653
|
this.adDetectSentForCurrentBreak = false;
|
|
7654
|
+
this.activeScte35BreakKey = void 0;
|
|
7655
|
+
this.scheduledScte35BreakKey = void 0;
|
|
6903
7656
|
this.expectedAdBreakDurationMs = void 0;
|
|
6904
7657
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
6905
7658
|
this.clearAdStartTimer();
|