stormcloud-video-player 0.8.14 → 0.8.16
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 +85 -47
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +5 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +85 -47
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +85 -47
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +5 -0
- package/lib/players/HlsPlayer.cjs +85 -47
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +85 -47
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +85 -47
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +15 -5
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/package.json +1 -1
package/lib/players/index.cjs
CHANGED
|
@@ -2745,6 +2745,7 @@ function logBrowserInfo() {
|
|
|
2745
2745
|
// src/utils/ctvVastSignals.ts
|
|
2746
2746
|
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
2747
2747
|
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
2748
|
+
var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
2748
2749
|
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2749
2750
|
var DEVICE_ID_STORAGE_KEYS = [
|
|
2750
2751
|
"rdid",
|
|
@@ -2762,8 +2763,9 @@ function resolveCtvVastSignals() {
|
|
|
2762
2763
|
var bridgeSignals = readNativeBridgeSignals();
|
|
2763
2764
|
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2764
2765
|
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
2766
|
+
var contentUrl = bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL;
|
|
2765
2767
|
return _object_spread_props(_object_spread({
|
|
2766
|
-
contentUrl:
|
|
2768
|
+
contentUrl: contentUrl,
|
|
2767
2769
|
appId: AIRY_ANDROID_APP_ID,
|
|
2768
2770
|
appName: AIRY_APP_NAME,
|
|
2769
2771
|
sessionId: getOrCreateCtvSessionId()
|
|
@@ -2814,6 +2816,12 @@ function readNativeBridgeSignals() {
|
|
|
2814
2816
|
try {
|
|
2815
2817
|
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2816
2818
|
var source = _step.value;
|
|
2819
|
+
var contentUrl = readBridgeValue(source, [
|
|
2820
|
+
"contentUrl",
|
|
2821
|
+
"url",
|
|
2822
|
+
"videoUrl",
|
|
2823
|
+
"canonicalUrl"
|
|
2824
|
+
]) || void 0;
|
|
2817
2825
|
var deviceId = readBridgeValue(source, [
|
|
2818
2826
|
"rdid",
|
|
2819
2827
|
"ifa",
|
|
@@ -2821,7 +2829,7 @@ function readNativeBridgeSignals() {
|
|
|
2821
2829
|
"adId",
|
|
2822
2830
|
"deviceId"
|
|
2823
2831
|
]) || void 0;
|
|
2824
|
-
if (!deviceId) continue;
|
|
2832
|
+
if (!contentUrl && !deviceId) continue;
|
|
2825
2833
|
var deviceIdType = readBridgeValue(source, [
|
|
2826
2834
|
"idtype",
|
|
2827
2835
|
"deviceIdType",
|
|
@@ -2833,11 +2841,13 @@ function readNativeBridgeSignals() {
|
|
|
2833
2841
|
"limitedAdTracking",
|
|
2834
2842
|
"lat"
|
|
2835
2843
|
]);
|
|
2836
|
-
return _object_spread({
|
|
2844
|
+
return _object_spread({}, contentUrl ? {
|
|
2845
|
+
contentUrl: contentUrl
|
|
2846
|
+
} : {}, deviceId ? {
|
|
2837
2847
|
deviceId: deviceId
|
|
2838
|
-
}, deviceIdType ? {
|
|
2848
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2839
2849
|
deviceIdType: deviceIdType
|
|
2840
|
-
} : {}, limitAdTracking != null ? {
|
|
2850
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
2841
2851
|
limitAdTracking: limitAdTracking
|
|
2842
2852
|
} : {});
|
|
2843
2853
|
}
|
|
@@ -3597,7 +3607,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3597
3607
|
_this.showAds = true;
|
|
3598
3608
|
_this.resetGamNoFillCounter();
|
|
3599
3609
|
if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
|
|
3600
|
-
_this.
|
|
3610
|
+
_this.scheduleAdStopAtBreakBoundary();
|
|
3601
3611
|
if (_this.config.debugAdTiming) {
|
|
3602
3612
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3603
3613
|
}
|
|
@@ -4252,12 +4262,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4252
4262
|
if (marker.durationSeconds != null) {
|
|
4253
4263
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
4254
4264
|
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
4255
|
-
this.
|
|
4256
|
-
|
|
4257
|
-
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
4258
|
-
this.scheduleAdStopCountdown(remainingMs);
|
|
4265
|
+
this.setAdBreakDurationBoundary(newDurationMs);
|
|
4266
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4259
4267
|
if (this.config.debugAdTiming) {
|
|
4260
|
-
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(
|
|
4268
|
+
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(this.getWallClockRemainingAdMs(), "ms"));
|
|
4261
4269
|
}
|
|
4262
4270
|
}
|
|
4263
4271
|
}
|
|
@@ -4331,13 +4339,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4331
4339
|
}
|
|
4332
4340
|
if (marker.type === "progress" && this.inAdBreak) {
|
|
4333
4341
|
if (marker.durationSeconds != null) {
|
|
4334
|
-
this.
|
|
4335
|
-
}
|
|
4336
|
-
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4337
|
-
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
4338
|
-
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
4339
|
-
this.scheduleAdStopCountdown(remainingMs1);
|
|
4342
|
+
this.setAdBreakDurationBoundary(marker.durationSeconds * 1e3);
|
|
4340
4343
|
}
|
|
4344
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4341
4345
|
if (!this.adPlayer.isAdPlaying() && this.activeAdRequestToken === null && this.adRequestQueue.length > 0 && this.hasTimeToStartAnotherAd()) {
|
|
4342
4346
|
this.tryNextAvailableAdWithRateLimit();
|
|
4343
4347
|
}
|
|
@@ -4361,15 +4365,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4361
4365
|
activeAdRequest: this.activeAdRequestToken !== null
|
|
4362
4366
|
});
|
|
4363
4367
|
}
|
|
4364
|
-
|
|
4365
|
-
if (this.config.debugAdTiming) {
|
|
4366
|
-
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active");
|
|
4367
|
-
}
|
|
4368
|
-
return;
|
|
4369
|
-
}
|
|
4370
|
-
this.inAdBreak = false;
|
|
4371
|
-
this.expectedAdBreakDurationMs = void 0;
|
|
4372
|
-
this.currentAdBreakStartWallClockMs = void 0;
|
|
4368
|
+
this.scteAdBreakEndWallClockMs = Date.now();
|
|
4373
4369
|
this.clearAdStartTimer();
|
|
4374
4370
|
this.clearAdStopTimer();
|
|
4375
4371
|
if (adPlaying) {
|
|
@@ -4386,12 +4382,46 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4386
4382
|
this.inAdBreak = true;
|
|
4387
4383
|
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4388
4384
|
this.scheduledScte35BreakKey = void 0;
|
|
4389
|
-
this.
|
|
4390
|
-
this.
|
|
4385
|
+
this.currentAdBreakStartWallClockMs = this.resolveScteBreakStartWallClockMs(marker);
|
|
4386
|
+
this.setAdBreakDurationBoundary(durationMs);
|
|
4391
4387
|
this.handleAdStart(marker);
|
|
4392
|
-
|
|
4393
|
-
|
|
4388
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4389
|
+
}
|
|
4390
|
+
},
|
|
4391
|
+
{
|
|
4392
|
+
key: "resolveScteBreakStartWallClockMs",
|
|
4393
|
+
value: function resolveScteBreakStartWallClockMs(marker) {
|
|
4394
|
+
var nowWallClockMs = Date.now();
|
|
4395
|
+
if (typeof marker.ptsSeconds !== "number") {
|
|
4396
|
+
return nowWallClockMs;
|
|
4397
|
+
}
|
|
4398
|
+
var nowMs = this.video.currentTime * 1e3;
|
|
4399
|
+
var estimatedCurrentPtsMs = nowMs - this.ptsDriftEmaMs;
|
|
4400
|
+
var deltaMs = marker.ptsSeconds * 1e3 - estimatedCurrentPtsMs;
|
|
4401
|
+
if (!Number.isFinite(deltaMs)) {
|
|
4402
|
+
return nowWallClockMs;
|
|
4403
|
+
}
|
|
4404
|
+
return nowWallClockMs + Math.floor(deltaMs);
|
|
4405
|
+
}
|
|
4406
|
+
},
|
|
4407
|
+
{
|
|
4408
|
+
key: "setAdBreakDurationBoundary",
|
|
4409
|
+
value: function setAdBreakDurationBoundary(durationMs) {
|
|
4410
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4411
|
+
if (durationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4412
|
+
this.scteAdBreakEndWallClockMs = this.currentAdBreakStartWallClockMs + durationMs;
|
|
4413
|
+
} else {
|
|
4414
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
4415
|
+
}
|
|
4416
|
+
}
|
|
4417
|
+
},
|
|
4418
|
+
{
|
|
4419
|
+
key: "scheduleAdStopAtBreakBoundary",
|
|
4420
|
+
value: function scheduleAdStopAtBreakBoundary() {
|
|
4421
|
+
if (this.expectedAdBreakDurationMs == null) {
|
|
4422
|
+
return;
|
|
4394
4423
|
}
|
|
4424
|
+
this.scheduleAdStopCountdown(this.getWallClockRemainingAdMs());
|
|
4395
4425
|
}
|
|
4396
4426
|
},
|
|
4397
4427
|
{
|
|
@@ -6041,7 +6071,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6041
6071
|
currentVolume = this.video.volume;
|
|
6042
6072
|
this.adPlayer.updateOriginalMutedState(currentMuted, currentVolume);
|
|
6043
6073
|
this.inAdBreak = true;
|
|
6044
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
6045
6074
|
this.adBreakPlayedDurationMs = 0;
|
|
6046
6075
|
this.currentAdIndex = 0;
|
|
6047
6076
|
this.totalAdsInBreak = 0;
|
|
@@ -6147,7 +6176,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6147
6176
|
_state.sent();
|
|
6148
6177
|
this.markAdStarted();
|
|
6149
6178
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6150
|
-
this.
|
|
6179
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6151
6180
|
}
|
|
6152
6181
|
adVolume = currentMuted ? 0 : currentVolume;
|
|
6153
6182
|
this.adPlayer.setAdVolume(adVolume);
|
|
@@ -6207,7 +6236,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6207
6236
|
_state.sent();
|
|
6208
6237
|
this.markAdStarted();
|
|
6209
6238
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6210
|
-
this.
|
|
6239
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6211
6240
|
}
|
|
6212
6241
|
adVolume1 = currentMuted ? 0 : currentVolume;
|
|
6213
6242
|
this.adPlayer.setAdVolume(adVolume1);
|
|
@@ -6280,7 +6309,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6280
6309
|
_state.sent();
|
|
6281
6310
|
this.markAdStarted();
|
|
6282
6311
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6283
|
-
this.
|
|
6312
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6284
6313
|
}
|
|
6285
6314
|
adVolume2 = currentMuted ? 0 : currentVolume;
|
|
6286
6315
|
this.adPlayer.setAdVolume(adVolume2);
|
|
@@ -6663,7 +6692,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6663
6692
|
_state.sent();
|
|
6664
6693
|
this.markAdStarted();
|
|
6665
6694
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6666
|
-
this.
|
|
6695
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6667
6696
|
}
|
|
6668
6697
|
this.adPlayer.setAdVolume(this.getAdAudioVolume());
|
|
6669
6698
|
this.consecutiveFailures = 0;
|
|
@@ -7191,19 +7220,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7191
7220
|
{
|
|
7192
7221
|
key: "ensureAdStoppedByTimer",
|
|
7193
7222
|
value: function ensureAdStoppedByTimer() {
|
|
7194
|
-
var _this_config_adBreakCheckIntervalMs,
|
|
7223
|
+
var _this_config_adBreakCheckIntervalMs, _this_getAdBreakEndWallClockMs;
|
|
7195
7224
|
if (!this.inAdBreak) return;
|
|
7196
7225
|
this.adStopTimerId = void 0;
|
|
7197
7226
|
var adPlaying = this.adPlayer.isAdPlaying();
|
|
7198
7227
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
7199
7228
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
7200
7229
|
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 0;
|
|
7201
|
-
var
|
|
7202
|
-
|
|
7203
|
-
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
7204
|
-
}
|
|
7205
|
-
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
7206
|
-
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
7230
|
+
var endWallClockMs = (_this_getAdBreakEndWallClockMs = this.getAdBreakEndWallClockMs()) !== null && _this_getAdBreakEndWallClockMs !== void 0 ? _this_getAdBreakEndWallClockMs : Date.now();
|
|
7231
|
+
var overrunMs = Math.max(0, Date.now() - endWallClockMs);
|
|
7207
7232
|
var shouldExtendAdBreak = adPlaying && overrunMs < maxExtensionMs;
|
|
7208
7233
|
if (shouldExtendAdBreak) {
|
|
7209
7234
|
this.scheduleAdStopCountdown(checkIntervalMs);
|
|
@@ -7479,7 +7504,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7479
7504
|
_state.sent();
|
|
7480
7505
|
this.markAdStarted();
|
|
7481
7506
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7482
|
-
this.
|
|
7507
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7483
7508
|
}
|
|
7484
7509
|
this.adPlayer.setAdVolume(this.getAdAudioVolume());
|
|
7485
7510
|
this.consecutiveFailures = 0;
|
|
@@ -7531,7 +7556,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7531
7556
|
_state.sent();
|
|
7532
7557
|
this.markAdStarted();
|
|
7533
7558
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7534
|
-
this.
|
|
7559
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7535
7560
|
}
|
|
7536
7561
|
this.adPlayer.setAdVolume(this.getAdAudioVolume());
|
|
7537
7562
|
return [
|
|
@@ -7677,6 +7702,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7677
7702
|
this.scheduledScte35BreakKey = void 0;
|
|
7678
7703
|
this.expectedAdBreakDurationMs = void 0;
|
|
7679
7704
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
7705
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
7680
7706
|
this.clearAdStartTimer();
|
|
7681
7707
|
this.clearAdStopTimer();
|
|
7682
7708
|
this.adPodQueue = [];
|
|
@@ -7864,11 +7890,23 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7864
7890
|
{
|
|
7865
7891
|
key: "getWallClockRemainingAdMs",
|
|
7866
7892
|
value: function getWallClockRemainingAdMs() {
|
|
7893
|
+
var endWallClockMs = this.getAdBreakEndWallClockMs();
|
|
7894
|
+
if (endWallClockMs != null) {
|
|
7895
|
+
return Math.max(0, endWallClockMs - Date.now());
|
|
7896
|
+
}
|
|
7897
|
+
return 0;
|
|
7898
|
+
}
|
|
7899
|
+
},
|
|
7900
|
+
{
|
|
7901
|
+
key: "getAdBreakEndWallClockMs",
|
|
7902
|
+
value: function getAdBreakEndWallClockMs() {
|
|
7903
|
+
if (this.scteAdBreakEndWallClockMs != null) {
|
|
7904
|
+
return this.scteAdBreakEndWallClockMs;
|
|
7905
|
+
}
|
|
7867
7906
|
if (this.expectedAdBreakDurationMs == null || this.currentAdBreakStartWallClockMs == null) {
|
|
7868
|
-
return 0;
|
|
7907
|
+
return void 0;
|
|
7869
7908
|
}
|
|
7870
|
-
|
|
7871
|
-
return Math.max(0, this.expectedAdBreakDurationMs - elapsed);
|
|
7909
|
+
return this.currentAdBreakStartWallClockMs + this.expectedAdBreakDurationMs;
|
|
7872
7910
|
}
|
|
7873
7911
|
},
|
|
7874
7912
|
{
|