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
|
@@ -2657,6 +2657,7 @@ function logBrowserInfo() {
|
|
|
2657
2657
|
// src/utils/ctvVastSignals.ts
|
|
2658
2658
|
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
2659
2659
|
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
2660
|
+
var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
2660
2661
|
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2661
2662
|
var DEVICE_ID_STORAGE_KEYS = [
|
|
2662
2663
|
"rdid",
|
|
@@ -2674,8 +2675,9 @@ function resolveCtvVastSignals() {
|
|
|
2674
2675
|
var bridgeSignals = readNativeBridgeSignals();
|
|
2675
2676
|
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2676
2677
|
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
2678
|
+
var contentUrl = bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL;
|
|
2677
2679
|
return _object_spread_props(_object_spread({
|
|
2678
|
-
contentUrl:
|
|
2680
|
+
contentUrl: contentUrl,
|
|
2679
2681
|
appId: AIRY_ANDROID_APP_ID,
|
|
2680
2682
|
appName: AIRY_APP_NAME,
|
|
2681
2683
|
sessionId: getOrCreateCtvSessionId()
|
|
@@ -2726,6 +2728,12 @@ function readNativeBridgeSignals() {
|
|
|
2726
2728
|
try {
|
|
2727
2729
|
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2728
2730
|
var source = _step.value;
|
|
2731
|
+
var contentUrl = readBridgeValue(source, [
|
|
2732
|
+
"contentUrl",
|
|
2733
|
+
"url",
|
|
2734
|
+
"videoUrl",
|
|
2735
|
+
"canonicalUrl"
|
|
2736
|
+
]) || void 0;
|
|
2729
2737
|
var deviceId = readBridgeValue(source, [
|
|
2730
2738
|
"rdid",
|
|
2731
2739
|
"ifa",
|
|
@@ -2733,7 +2741,7 @@ function readNativeBridgeSignals() {
|
|
|
2733
2741
|
"adId",
|
|
2734
2742
|
"deviceId"
|
|
2735
2743
|
]) || void 0;
|
|
2736
|
-
if (!deviceId) continue;
|
|
2744
|
+
if (!contentUrl && !deviceId) continue;
|
|
2737
2745
|
var deviceIdType = readBridgeValue(source, [
|
|
2738
2746
|
"idtype",
|
|
2739
2747
|
"deviceIdType",
|
|
@@ -2745,11 +2753,13 @@ function readNativeBridgeSignals() {
|
|
|
2745
2753
|
"limitedAdTracking",
|
|
2746
2754
|
"lat"
|
|
2747
2755
|
]);
|
|
2748
|
-
return _object_spread({
|
|
2756
|
+
return _object_spread({}, contentUrl ? {
|
|
2757
|
+
contentUrl: contentUrl
|
|
2758
|
+
} : {}, deviceId ? {
|
|
2749
2759
|
deviceId: deviceId
|
|
2750
|
-
}, deviceIdType ? {
|
|
2760
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2751
2761
|
deviceIdType: deviceIdType
|
|
2752
|
-
} : {}, limitAdTracking != null ? {
|
|
2762
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
2753
2763
|
limitAdTracking: limitAdTracking
|
|
2754
2764
|
} : {});
|
|
2755
2765
|
}
|
|
@@ -3509,7 +3519,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3509
3519
|
_this.showAds = true;
|
|
3510
3520
|
_this.resetGamNoFillCounter();
|
|
3511
3521
|
if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null && _this.adStopTimerId == null) {
|
|
3512
|
-
_this.
|
|
3522
|
+
_this.scheduleAdStopAtBreakBoundary();
|
|
3513
3523
|
if (_this.config.debugAdTiming) {
|
|
3514
3524
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3515
3525
|
}
|
|
@@ -4164,12 +4174,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4164
4174
|
if (marker.durationSeconds != null) {
|
|
4165
4175
|
var newDurationMs = marker.durationSeconds * 1e3;
|
|
4166
4176
|
if (this.expectedAdBreakDurationMs == null || newDurationMs > this.expectedAdBreakDurationMs) {
|
|
4167
|
-
this.
|
|
4168
|
-
|
|
4169
|
-
var remainingMs = Math.max(0, newDurationMs - elapsedMs);
|
|
4170
|
-
this.scheduleAdStopCountdown(remainingMs);
|
|
4177
|
+
this.setAdBreakDurationBoundary(newDurationMs);
|
|
4178
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4171
4179
|
if (this.config.debugAdTiming) {
|
|
4172
|
-
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(
|
|
4180
|
+
console.log("[StormcloudVideoPlayer] Updated ad break duration from subsequent marker: ".concat(newDurationMs, "ms, remaining: ").concat(this.getWallClockRemainingAdMs(), "ms"));
|
|
4173
4181
|
}
|
|
4174
4182
|
}
|
|
4175
4183
|
}
|
|
@@ -4243,13 +4251,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4243
4251
|
}
|
|
4244
4252
|
if (marker.type === "progress" && this.inAdBreak) {
|
|
4245
4253
|
if (marker.durationSeconds != null) {
|
|
4246
|
-
this.
|
|
4247
|
-
}
|
|
4248
|
-
if (this.expectedAdBreakDurationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4249
|
-
var elapsedMs1 = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
4250
|
-
var remainingMs1 = Math.max(0, this.expectedAdBreakDurationMs - elapsedMs1);
|
|
4251
|
-
this.scheduleAdStopCountdown(remainingMs1);
|
|
4254
|
+
this.setAdBreakDurationBoundary(marker.durationSeconds * 1e3);
|
|
4252
4255
|
}
|
|
4256
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4253
4257
|
if (!this.adPlayer.isAdPlaying() && this.activeAdRequestToken === null && this.adRequestQueue.length > 0 && this.hasTimeToStartAnotherAd()) {
|
|
4254
4258
|
this.tryNextAvailableAdWithRateLimit();
|
|
4255
4259
|
}
|
|
@@ -4273,15 +4277,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4273
4277
|
activeAdRequest: this.activeAdRequestToken !== null
|
|
4274
4278
|
});
|
|
4275
4279
|
}
|
|
4276
|
-
|
|
4277
|
-
if (this.config.debugAdTiming) {
|
|
4278
|
-
console.log("[StormcloudVideoPlayer] Ignoring premature SCTE-35 end marker - ads still active");
|
|
4279
|
-
}
|
|
4280
|
-
return;
|
|
4281
|
-
}
|
|
4282
|
-
this.inAdBreak = false;
|
|
4283
|
-
this.expectedAdBreakDurationMs = void 0;
|
|
4284
|
-
this.currentAdBreakStartWallClockMs = void 0;
|
|
4280
|
+
this.scteAdBreakEndWallClockMs = Date.now();
|
|
4285
4281
|
this.clearAdStartTimer();
|
|
4286
4282
|
this.clearAdStopTimer();
|
|
4287
4283
|
if (adPlaying) {
|
|
@@ -4298,12 +4294,46 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4298
4294
|
this.inAdBreak = true;
|
|
4299
4295
|
this.activeScte35BreakKey = cueKey !== null && cueKey !== void 0 ? cueKey : this.pendingScte35CueKey;
|
|
4300
4296
|
this.scheduledScte35BreakKey = void 0;
|
|
4301
|
-
this.
|
|
4302
|
-
this.
|
|
4297
|
+
this.currentAdBreakStartWallClockMs = this.resolveScteBreakStartWallClockMs(marker);
|
|
4298
|
+
this.setAdBreakDurationBoundary(durationMs);
|
|
4303
4299
|
this.handleAdStart(marker);
|
|
4304
|
-
|
|
4305
|
-
|
|
4300
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
4301
|
+
}
|
|
4302
|
+
},
|
|
4303
|
+
{
|
|
4304
|
+
key: "resolveScteBreakStartWallClockMs",
|
|
4305
|
+
value: function resolveScteBreakStartWallClockMs(marker) {
|
|
4306
|
+
var nowWallClockMs = Date.now();
|
|
4307
|
+
if (typeof marker.ptsSeconds !== "number") {
|
|
4308
|
+
return nowWallClockMs;
|
|
4309
|
+
}
|
|
4310
|
+
var nowMs = this.video.currentTime * 1e3;
|
|
4311
|
+
var estimatedCurrentPtsMs = nowMs - this.ptsDriftEmaMs;
|
|
4312
|
+
var deltaMs = marker.ptsSeconds * 1e3 - estimatedCurrentPtsMs;
|
|
4313
|
+
if (!Number.isFinite(deltaMs)) {
|
|
4314
|
+
return nowWallClockMs;
|
|
4315
|
+
}
|
|
4316
|
+
return nowWallClockMs + Math.floor(deltaMs);
|
|
4317
|
+
}
|
|
4318
|
+
},
|
|
4319
|
+
{
|
|
4320
|
+
key: "setAdBreakDurationBoundary",
|
|
4321
|
+
value: function setAdBreakDurationBoundary(durationMs) {
|
|
4322
|
+
this.expectedAdBreakDurationMs = durationMs;
|
|
4323
|
+
if (durationMs != null && this.currentAdBreakStartWallClockMs != null) {
|
|
4324
|
+
this.scteAdBreakEndWallClockMs = this.currentAdBreakStartWallClockMs + durationMs;
|
|
4325
|
+
} else {
|
|
4326
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
},
|
|
4330
|
+
{
|
|
4331
|
+
key: "scheduleAdStopAtBreakBoundary",
|
|
4332
|
+
value: function scheduleAdStopAtBreakBoundary() {
|
|
4333
|
+
if (this.expectedAdBreakDurationMs == null) {
|
|
4334
|
+
return;
|
|
4306
4335
|
}
|
|
4336
|
+
this.scheduleAdStopCountdown(this.getWallClockRemainingAdMs());
|
|
4307
4337
|
}
|
|
4308
4338
|
},
|
|
4309
4339
|
{
|
|
@@ -5953,7 +5983,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5953
5983
|
currentVolume = this.video.volume;
|
|
5954
5984
|
this.adPlayer.updateOriginalMutedState(currentMuted, currentVolume);
|
|
5955
5985
|
this.inAdBreak = true;
|
|
5956
|
-
this.currentAdBreakStartWallClockMs = Date.now();
|
|
5957
5986
|
this.adBreakPlayedDurationMs = 0;
|
|
5958
5987
|
this.currentAdIndex = 0;
|
|
5959
5988
|
this.totalAdsInBreak = 0;
|
|
@@ -6059,7 +6088,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6059
6088
|
_state.sent();
|
|
6060
6089
|
this.markAdStarted();
|
|
6061
6090
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6062
|
-
this.
|
|
6091
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6063
6092
|
}
|
|
6064
6093
|
adVolume = currentMuted ? 0 : currentVolume;
|
|
6065
6094
|
this.adPlayer.setAdVolume(adVolume);
|
|
@@ -6119,7 +6148,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6119
6148
|
_state.sent();
|
|
6120
6149
|
this.markAdStarted();
|
|
6121
6150
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6122
|
-
this.
|
|
6151
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6123
6152
|
}
|
|
6124
6153
|
adVolume1 = currentMuted ? 0 : currentVolume;
|
|
6125
6154
|
this.adPlayer.setAdVolume(adVolume1);
|
|
@@ -6192,7 +6221,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6192
6221
|
_state.sent();
|
|
6193
6222
|
this.markAdStarted();
|
|
6194
6223
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6195
|
-
this.
|
|
6224
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6196
6225
|
}
|
|
6197
6226
|
adVolume2 = currentMuted ? 0 : currentVolume;
|
|
6198
6227
|
this.adPlayer.setAdVolume(adVolume2);
|
|
@@ -6575,7 +6604,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6575
6604
|
_state.sent();
|
|
6576
6605
|
this.markAdStarted();
|
|
6577
6606
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6578
|
-
this.
|
|
6607
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
6579
6608
|
}
|
|
6580
6609
|
this.adPlayer.setAdVolume(this.getAdAudioVolume());
|
|
6581
6610
|
this.consecutiveFailures = 0;
|
|
@@ -7103,19 +7132,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7103
7132
|
{
|
|
7104
7133
|
key: "ensureAdStoppedByTimer",
|
|
7105
7134
|
value: function ensureAdStoppedByTimer() {
|
|
7106
|
-
var _this_config_adBreakCheckIntervalMs,
|
|
7135
|
+
var _this_config_adBreakCheckIntervalMs, _this_getAdBreakEndWallClockMs;
|
|
7107
7136
|
if (!this.inAdBreak) return;
|
|
7108
7137
|
this.adStopTimerId = void 0;
|
|
7109
7138
|
var adPlaying = this.adPlayer.isAdPlaying();
|
|
7110
7139
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
7111
7140
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
7112
7141
|
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 0;
|
|
7113
|
-
var
|
|
7114
|
-
|
|
7115
|
-
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
7116
|
-
}
|
|
7117
|
-
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
7118
|
-
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
7142
|
+
var endWallClockMs = (_this_getAdBreakEndWallClockMs = this.getAdBreakEndWallClockMs()) !== null && _this_getAdBreakEndWallClockMs !== void 0 ? _this_getAdBreakEndWallClockMs : Date.now();
|
|
7143
|
+
var overrunMs = Math.max(0, Date.now() - endWallClockMs);
|
|
7119
7144
|
var shouldExtendAdBreak = adPlaying && overrunMs < maxExtensionMs;
|
|
7120
7145
|
if (shouldExtendAdBreak) {
|
|
7121
7146
|
this.scheduleAdStopCountdown(checkIntervalMs);
|
|
@@ -7391,7 +7416,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7391
7416
|
_state.sent();
|
|
7392
7417
|
this.markAdStarted();
|
|
7393
7418
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7394
|
-
this.
|
|
7419
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7395
7420
|
}
|
|
7396
7421
|
this.adPlayer.setAdVolume(this.getAdAudioVolume());
|
|
7397
7422
|
this.consecutiveFailures = 0;
|
|
@@ -7443,7 +7468,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7443
7468
|
_state.sent();
|
|
7444
7469
|
this.markAdStarted();
|
|
7445
7470
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7446
|
-
this.
|
|
7471
|
+
this.scheduleAdStopAtBreakBoundary();
|
|
7447
7472
|
}
|
|
7448
7473
|
this.adPlayer.setAdVolume(this.getAdAudioVolume());
|
|
7449
7474
|
return [
|
|
@@ -7589,6 +7614,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7589
7614
|
this.scheduledScte35BreakKey = void 0;
|
|
7590
7615
|
this.expectedAdBreakDurationMs = void 0;
|
|
7591
7616
|
this.currentAdBreakStartWallClockMs = void 0;
|
|
7617
|
+
this.scteAdBreakEndWallClockMs = void 0;
|
|
7592
7618
|
this.clearAdStartTimer();
|
|
7593
7619
|
this.clearAdStopTimer();
|
|
7594
7620
|
this.adPodQueue = [];
|
|
@@ -7776,11 +7802,23 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7776
7802
|
{
|
|
7777
7803
|
key: "getWallClockRemainingAdMs",
|
|
7778
7804
|
value: function getWallClockRemainingAdMs() {
|
|
7805
|
+
var endWallClockMs = this.getAdBreakEndWallClockMs();
|
|
7806
|
+
if (endWallClockMs != null) {
|
|
7807
|
+
return Math.max(0, endWallClockMs - Date.now());
|
|
7808
|
+
}
|
|
7809
|
+
return 0;
|
|
7810
|
+
}
|
|
7811
|
+
},
|
|
7812
|
+
{
|
|
7813
|
+
key: "getAdBreakEndWallClockMs",
|
|
7814
|
+
value: function getAdBreakEndWallClockMs() {
|
|
7815
|
+
if (this.scteAdBreakEndWallClockMs != null) {
|
|
7816
|
+
return this.scteAdBreakEndWallClockMs;
|
|
7817
|
+
}
|
|
7779
7818
|
if (this.expectedAdBreakDurationMs == null || this.currentAdBreakStartWallClockMs == null) {
|
|
7780
|
-
return 0;
|
|
7819
|
+
return void 0;
|
|
7781
7820
|
}
|
|
7782
|
-
|
|
7783
|
-
return Math.max(0, this.expectedAdBreakDurationMs - elapsed);
|
|
7821
|
+
return this.currentAdBreakStartWallClockMs + this.expectedAdBreakDurationMs;
|
|
7784
7822
|
}
|
|
7785
7823
|
},
|
|
7786
7824
|
{
|