stormcloud-video-player 0.3.52 → 0.3.54
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 +552 -406
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +359 -220
- package/lib/index.d.ts +359 -220
- package/lib/index.js +513 -367
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +283 -146
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +11 -0
- package/lib/players/FilePlayer.cjs +99 -116
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +335 -198
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +414 -277
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +17 -9
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/ima.cjs +43 -48
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +374 -228
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs +11 -11
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs +13 -13
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +19 -11
- package/lib/utils/tracking.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -180,12 +180,22 @@ function _object_spread_props(target, source) {
|
|
|
180
180
|
}
|
|
181
181
|
function _object_without_properties(source, excluded) {
|
|
182
182
|
if (source == null) return {};
|
|
183
|
-
var target =
|
|
184
|
-
|
|
183
|
+
var target = {}, sourceKeys, key, i;
|
|
184
|
+
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
185
|
+
sourceKeys = Reflect.ownKeys(Object(source));
|
|
186
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
187
|
+
key = sourceKeys[i];
|
|
188
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
189
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
190
|
+
target[key] = source[key];
|
|
191
|
+
}
|
|
192
|
+
return target;
|
|
193
|
+
}
|
|
194
|
+
target = _object_without_properties_loose(source, excluded);
|
|
185
195
|
if (Object.getOwnPropertySymbols) {
|
|
186
|
-
|
|
187
|
-
for(i = 0; i <
|
|
188
|
-
key =
|
|
196
|
+
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
197
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
198
|
+
key = sourceKeys[i];
|
|
189
199
|
if (excluded.indexOf(key) >= 0) continue;
|
|
190
200
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
191
201
|
target[key] = source[key];
|
|
@@ -195,12 +205,11 @@ function _object_without_properties(source, excluded) {
|
|
|
195
205
|
}
|
|
196
206
|
function _object_without_properties_loose(source, excluded) {
|
|
197
207
|
if (source == null) return {};
|
|
198
|
-
var target = {};
|
|
199
|
-
var sourceKeys = Object.keys(source);
|
|
200
|
-
var key, i;
|
|
208
|
+
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
201
209
|
for(i = 0; i < sourceKeys.length; i++){
|
|
202
210
|
key = sourceKeys[i];
|
|
203
211
|
if (excluded.indexOf(key) >= 0) continue;
|
|
212
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
204
213
|
target[key] = source[key];
|
|
205
214
|
}
|
|
206
215
|
return target;
|
|
@@ -253,9 +262,17 @@ function _ts_generator(thisArg, body) {
|
|
|
253
262
|
},
|
|
254
263
|
trys: [],
|
|
255
264
|
ops: []
|
|
256
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
257
|
-
return
|
|
258
|
-
|
|
265
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
266
|
+
return d(g, "next", {
|
|
267
|
+
value: verb(0)
|
|
268
|
+
}), d(g, "throw", {
|
|
269
|
+
value: verb(1)
|
|
270
|
+
}), d(g, "return", {
|
|
271
|
+
value: verb(2)
|
|
272
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
273
|
+
value: function() {
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
259
276
|
}), g;
|
|
260
277
|
function verb(n) {
|
|
261
278
|
return function(v) {
|
|
@@ -709,7 +726,7 @@ function createImaController(video, options) {
|
|
|
709
726
|
var fn = _step.value;
|
|
710
727
|
try {
|
|
711
728
|
fn(payload);
|
|
712
|
-
} catch (
|
|
729
|
+
} catch (unused) {}
|
|
713
730
|
}
|
|
714
731
|
} catch (err) {
|
|
715
732
|
_didIteratorError = true;
|
|
@@ -747,7 +764,7 @@ function createImaController(video, options) {
|
|
|
747
764
|
console.error("StormcloudVideoPlayer: The host page is inside a sandboxed iframe without 'allow-scripts'. Google IMA cannot run ads within sandboxed frames. Remove the sandbox attribute or include 'allow-scripts allow-same-origin'.");
|
|
748
765
|
}
|
|
749
766
|
}
|
|
750
|
-
} catch (
|
|
767
|
+
} catch (unused) {}
|
|
751
768
|
if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
|
|
752
769
|
var existing = document.querySelector('script[data-ima="true"]');
|
|
753
770
|
if (existing) {
|
|
@@ -789,9 +806,6 @@ function createImaController(video, options) {
|
|
|
789
806
|
var adDisplayContainer;
|
|
790
807
|
var adContainerEl;
|
|
791
808
|
var lastAdTagUrl;
|
|
792
|
-
var retryAttempts = 0;
|
|
793
|
-
var maxRetries = 2;
|
|
794
|
-
var backoffBaseMs = 500;
|
|
795
809
|
var adsLoadedPromise;
|
|
796
810
|
var adsLoadedResolve;
|
|
797
811
|
var adsLoadedReject;
|
|
@@ -995,7 +1009,7 @@ function createImaController(video, options) {
|
|
|
995
1009
|
if (adsManager) {
|
|
996
1010
|
try {
|
|
997
1011
|
adsManager.destroy();
|
|
998
|
-
} catch (
|
|
1012
|
+
} catch (unused) {}
|
|
999
1013
|
adsManager = void 0;
|
|
1000
1014
|
}
|
|
1001
1015
|
if (adVideoElement) {
|
|
@@ -1006,7 +1020,7 @@ function createImaController(video, options) {
|
|
|
1006
1020
|
if (adsLoader) {
|
|
1007
1021
|
try {
|
|
1008
1022
|
adsLoader.destroy();
|
|
1009
|
-
} catch (
|
|
1023
|
+
} catch (unused) {}
|
|
1010
1024
|
adsLoader = void 0;
|
|
1011
1025
|
}
|
|
1012
1026
|
}
|
|
@@ -1024,7 +1038,7 @@ function createImaController(video, options) {
|
|
|
1024
1038
|
try {
|
|
1025
1039
|
var _adDisplayContainer_initialize;
|
|
1026
1040
|
(_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
|
|
1027
|
-
} catch (
|
|
1041
|
+
} catch (unused) {}
|
|
1028
1042
|
}
|
|
1029
1043
|
}).catch(function() {});
|
|
1030
1044
|
},
|
|
@@ -1088,7 +1102,6 @@ function createImaController(video, options) {
|
|
|
1088
1102
|
_state.sent();
|
|
1089
1103
|
google = window.google;
|
|
1090
1104
|
lastAdTagUrl = vastTagUrl;
|
|
1091
|
-
retryAttempts = 0;
|
|
1092
1105
|
if (!adDisplayContainer) {
|
|
1093
1106
|
container = document.createElement("div");
|
|
1094
1107
|
container.style.position = "absolute";
|
|
@@ -1172,32 +1185,23 @@ function createImaController(video, options) {
|
|
|
1172
1185
|
}
|
|
1173
1186
|
}, 300);
|
|
1174
1187
|
}
|
|
1175
|
-
|
|
1188
|
+
showContentVideo();
|
|
1176
1189
|
if (adsLoadedReject) {
|
|
1177
1190
|
adsLoadedReject(new Error("Ad playback error"));
|
|
1178
1191
|
adsLoadedReject = void 0;
|
|
1179
1192
|
adsLoadedResolve = void 0;
|
|
1180
1193
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
message: errorMessage,
|
|
1193
|
-
cause: innerError,
|
|
1194
|
-
isNoFill: isNoFill
|
|
1195
|
-
});
|
|
1196
|
-
if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
1197
|
-
if (video.paused) {
|
|
1198
|
-
var _video_play;
|
|
1199
|
-
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
|
|
1200
|
-
}
|
|
1194
|
+
emit("ad_error", {
|
|
1195
|
+
code: errorCode,
|
|
1196
|
+
vastErrorCode: vastErrorCode,
|
|
1197
|
+
message: errorMessage,
|
|
1198
|
+
cause: innerError,
|
|
1199
|
+
isNoFill: isNoFill
|
|
1200
|
+
});
|
|
1201
|
+
if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
1202
|
+
if (video.paused) {
|
|
1203
|
+
var _video_play;
|
|
1204
|
+
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function() {});
|
|
1201
1205
|
}
|
|
1202
1206
|
}
|
|
1203
1207
|
});
|
|
@@ -1215,7 +1219,7 @@ function createImaController(video, options) {
|
|
|
1215
1219
|
if (adsManager) {
|
|
1216
1220
|
try {
|
|
1217
1221
|
adsManager.setVolume(adVolume);
|
|
1218
|
-
} catch (
|
|
1222
|
+
} catch (unused) {}
|
|
1219
1223
|
}
|
|
1220
1224
|
emit("content_pause");
|
|
1221
1225
|
});
|
|
@@ -1229,7 +1233,7 @@ function createImaController(video, options) {
|
|
|
1229
1233
|
if (adsManager) {
|
|
1230
1234
|
try {
|
|
1231
1235
|
adsManager.setVolume(originalMutedState ? 0 : adVolume);
|
|
1232
|
-
} catch (
|
|
1236
|
+
} catch (unused) {}
|
|
1233
1237
|
}
|
|
1234
1238
|
}
|
|
1235
1239
|
if (adContainerEl) {
|
|
@@ -1243,7 +1247,7 @@ function createImaController(video, options) {
|
|
|
1243
1247
|
adsManager.addEventListener(AdEvent.CONTENT_RESUME_REQUESTED, function() {
|
|
1244
1248
|
adPlaying = false;
|
|
1245
1249
|
setAdPlayingFlag(false);
|
|
1246
|
-
|
|
1250
|
+
showContentVideo();
|
|
1247
1251
|
emit("content_resume");
|
|
1248
1252
|
});
|
|
1249
1253
|
adsManager.addEventListener(AdEvent.ALL_ADS_COMPLETED, function() {
|
|
@@ -1259,7 +1263,7 @@ function createImaController(video, options) {
|
|
|
1259
1263
|
}
|
|
1260
1264
|
}, 300);
|
|
1261
1265
|
}
|
|
1262
|
-
|
|
1266
|
+
showContentVideo();
|
|
1263
1267
|
emit("all_ads_completed");
|
|
1264
1268
|
});
|
|
1265
1269
|
if (adsLoadedResolve) {
|
|
@@ -1281,7 +1285,7 @@ function createImaController(video, options) {
|
|
|
1281
1285
|
}
|
|
1282
1286
|
}, 300);
|
|
1283
1287
|
}
|
|
1284
|
-
|
|
1288
|
+
showContentVideo();
|
|
1285
1289
|
if (adsLoadedReject) {
|
|
1286
1290
|
adsLoadedReject(new Error("Failed to setup ads manager"));
|
|
1287
1291
|
adsLoadedReject = void 0;
|
|
@@ -1324,7 +1328,7 @@ function createImaController(video, options) {
|
|
|
1324
1328
|
}
|
|
1325
1329
|
}, 300);
|
|
1326
1330
|
}
|
|
1327
|
-
|
|
1331
|
+
showContentVideo();
|
|
1328
1332
|
if (adsLoadedReject) {
|
|
1329
1333
|
adsLoadedReject(new Error(isNoFill ? "No ads available" : "Ads loader error"));
|
|
1330
1334
|
adsLoadedReject = void 0;
|
|
@@ -1390,7 +1394,7 @@ function createImaController(video, options) {
|
|
|
1390
1394
|
}
|
|
1391
1395
|
try {
|
|
1392
1396
|
adsManager.setVolume(originalMutedState ? 0 : adVolume);
|
|
1393
|
-
} catch (
|
|
1397
|
+
} catch (unused) {}
|
|
1394
1398
|
adsManager.start();
|
|
1395
1399
|
return [
|
|
1396
1400
|
2,
|
|
@@ -1472,7 +1476,7 @@ function createImaController(video, options) {
|
|
|
1472
1476
|
try {
|
|
1473
1477
|
;
|
|
1474
1478
|
adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
|
|
1475
|
-
} catch (
|
|
1479
|
+
} catch (unused) {}
|
|
1476
1480
|
destroyAdsManager();
|
|
1477
1481
|
return [
|
|
1478
1482
|
2
|
|
@@ -1503,7 +1507,7 @@ function createImaController(video, options) {
|
|
|
1503
1507
|
try {
|
|
1504
1508
|
var _adsLoader_destroy;
|
|
1505
1509
|
adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
|
|
1506
|
-
} catch (
|
|
1510
|
+
} catch (unused) {}
|
|
1507
1511
|
adDisplayContainer = void 0;
|
|
1508
1512
|
adsLoader = void 0;
|
|
1509
1513
|
contentVideoHidden = false;
|
|
@@ -1552,7 +1556,7 @@ function createImaController(video, options) {
|
|
|
1552
1556
|
if (adsManager && adPlaying) {
|
|
1553
1557
|
try {
|
|
1554
1558
|
adsManager.setVolume(clampedVolume);
|
|
1555
|
-
} catch (
|
|
1559
|
+
} catch (unused) {}
|
|
1556
1560
|
}
|
|
1557
1561
|
},
|
|
1558
1562
|
getAdVolume: function getAdVolume() {
|
|
@@ -3048,22 +3052,29 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3048
3052
|
this.maxPlaceholderDurationMs = 5e3;
|
|
3049
3053
|
this.isShowingPlaceholder = false;
|
|
3050
3054
|
this.totalAdRequestsInBreak = 0;
|
|
3051
|
-
this.maxTotalAdRequestsPerBreak =
|
|
3055
|
+
this.maxTotalAdRequestsPerBreak = 10;
|
|
3052
3056
|
this.pendingAdBreak = null;
|
|
3053
3057
|
this.consecutiveFailures = 0;
|
|
3054
3058
|
this.maxConsecutiveFailures = 5;
|
|
3055
3059
|
this.lastAdRequestTime = 0;
|
|
3056
|
-
this.minAdRequestIntervalMs =
|
|
3060
|
+
this.minAdRequestIntervalMs = 3e3;
|
|
3057
3061
|
this.backoffBaseMs = 1e3;
|
|
3058
3062
|
this.maxBackoffMs = 15e3;
|
|
3063
|
+
this.globalConsecutiveNoFills = 0;
|
|
3064
|
+
this.globalNoFillThreshold = 3;
|
|
3065
|
+
this.globalNoFillCooldownUntil = 0;
|
|
3066
|
+
this.globalNoFillBackoffBaseMs = 5e3;
|
|
3067
|
+
this.globalNoFillBackoffMaxMs = 6e4;
|
|
3068
|
+
this.globalLastGamRequestTime = 0;
|
|
3069
|
+
this.globalMinGamIntervalMs = 3e3;
|
|
3059
3070
|
this.preloadPool = [];
|
|
3060
|
-
this.maxPreloadPoolSize =
|
|
3071
|
+
this.maxPreloadPoolSize = 2;
|
|
3061
3072
|
this.preloadPoolActive = false;
|
|
3062
3073
|
this.preloadPoolLoopRunning = false;
|
|
3063
3074
|
this.continuousFetchLoopRunning = false;
|
|
3064
3075
|
initializePolyfills();
|
|
3065
3076
|
var browserOverrides = getBrowserConfigOverrides();
|
|
3066
|
-
this.config = _object_spread({},
|
|
3077
|
+
this.config = _object_spread({}, browserOverrides, config);
|
|
3067
3078
|
this.video = config.videoElement;
|
|
3068
3079
|
logBrowserInfo(config.debugAdTiming);
|
|
3069
3080
|
this.ima = this.createAdPlayer(false);
|
|
@@ -3200,7 +3211,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3200
3211
|
});
|
|
3201
3212
|
this.hls.on(Hls2.Events.MANIFEST_PARSED, function(_, data) {
|
|
3202
3213
|
return _async_to_generator(function() {
|
|
3203
|
-
var
|
|
3214
|
+
var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
|
|
3204
3215
|
return _ts_generator(this, function(_state) {
|
|
3205
3216
|
switch(_state.label){
|
|
3206
3217
|
case 0:
|
|
@@ -3209,10 +3220,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3209
3220
|
} else {
|
|
3210
3221
|
;
|
|
3211
3222
|
;
|
|
3212
|
-
this.isLiveStream = (
|
|
3223
|
+
this.isLiveStream = (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
|
|
3213
3224
|
var _level_details, _level_details1;
|
|
3214
3225
|
return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
|
|
3215
|
-
})) !== null &&
|
|
3226
|
+
})) !== null && _ref !== void 0 ? _ref : false;
|
|
3216
3227
|
}
|
|
3217
3228
|
if (this.config.debugAdTiming) {
|
|
3218
3229
|
adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
@@ -3276,9 +3287,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3276
3287
|
var tag = "";
|
|
3277
3288
|
var value = "";
|
|
3278
3289
|
if (Array.isArray(entry)) {
|
|
3279
|
-
var _entry_;
|
|
3290
|
+
var _entry_, _entry_1;
|
|
3280
3291
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
3281
|
-
var _entry_1;
|
|
3282
3292
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
3283
3293
|
} else if (typeof entry === "string") {
|
|
3284
3294
|
var idx = entry.indexOf(":");
|
|
@@ -3401,9 +3411,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3401
3411
|
var tag = "";
|
|
3402
3412
|
var value = "";
|
|
3403
3413
|
if (Array.isArray(entry)) {
|
|
3404
|
-
var _entry_;
|
|
3414
|
+
var _entry_, _entry_1;
|
|
3405
3415
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
3406
|
-
var _entry_1;
|
|
3407
3416
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
3408
3417
|
} else if (typeof entry === "string") {
|
|
3409
3418
|
var idx = entry.indexOf(":");
|
|
@@ -3453,10 +3462,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3453
3462
|
}
|
|
3454
3463
|
});
|
|
3455
3464
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
3465
|
+
var _attrs_CLASS;
|
|
3456
3466
|
var attrs = _this.parseAttributeList(value);
|
|
3457
3467
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
3458
3468
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
3459
|
-
var _attrs_CLASS;
|
|
3460
3469
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
3461
3470
|
var duration = _this.toNumber(attrs["DURATION"]);
|
|
3462
3471
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -3570,6 +3579,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3570
3579
|
_this.clearAdRequestWatchdog();
|
|
3571
3580
|
_this.activeAdRequestToken = null;
|
|
3572
3581
|
_this.showAds = true;
|
|
3582
|
+
_this.resetGamNoFillCounter();
|
|
3573
3583
|
if (_this.inAdBreak && _this.expectedAdBreakDurationMs != null) {
|
|
3574
3584
|
if (_this.adStopTimerId == null) {
|
|
3575
3585
|
_this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -3858,11 +3868,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3858
3868
|
}
|
|
3859
3869
|
var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
|
|
3860
3870
|
if (daterangeMatch) {
|
|
3861
|
-
var _daterangeMatch_;
|
|
3871
|
+
var _daterangeMatch_, _attrs_CLASS;
|
|
3862
3872
|
var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
|
|
3863
3873
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
3864
3874
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
3865
|
-
var _attrs_CLASS;
|
|
3866
3875
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
3867
3876
|
var duration = this.toNumber(attrs["DURATION"]);
|
|
3868
3877
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -3938,7 +3947,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3938
3947
|
var out = "";
|
|
3939
3948
|
for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
|
|
3940
3949
|
return out;
|
|
3941
|
-
} catch (
|
|
3950
|
+
} catch (unused) {
|
|
3942
3951
|
return void 0;
|
|
3943
3952
|
}
|
|
3944
3953
|
}
|
|
@@ -3957,6 +3966,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3957
3966
|
});
|
|
3958
3967
|
}
|
|
3959
3968
|
if (marker.type === "start") {
|
|
3969
|
+
var _this_config_immediateManifestAds;
|
|
3960
3970
|
var _this_pendingAdBreak;
|
|
3961
3971
|
if (!this.video.muted) {
|
|
3962
3972
|
this.video.muted = true;
|
|
@@ -3981,7 +3991,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3981
3991
|
this.expectedAdBreakDurationMs = durationMs;
|
|
3982
3992
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
3983
3993
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
3984
|
-
var _this_config_immediateManifestAds;
|
|
3985
3994
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
3986
3995
|
if (this.config.debugAdTiming) {
|
|
3987
3996
|
console.log("[StormcloudVideoPlayer] Ad start decision:", {
|
|
@@ -4136,9 +4145,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4136
4145
|
var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
|
|
4137
4146
|
var match;
|
|
4138
4147
|
while((match = regex.exec(value)) !== null){
|
|
4139
|
-
var _match_;
|
|
4148
|
+
var _match_, _ref, _match_1;
|
|
4140
4149
|
var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
|
|
4141
|
-
var _match_1, _ref;
|
|
4142
4150
|
var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
|
|
4143
4151
|
if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
|
|
4144
4152
|
rawVal = rawVal.slice(1, -1);
|
|
@@ -4483,13 +4491,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4483
4491
|
{
|
|
4484
4492
|
key: "shouldShowNativeControls",
|
|
4485
4493
|
value: function shouldShowNativeControls() {
|
|
4494
|
+
var _this_config_showCustomControls;
|
|
4486
4495
|
var streamType = this.getStreamType();
|
|
4487
4496
|
if (streamType === "other") {
|
|
4488
|
-
var
|
|
4489
|
-
return !((
|
|
4497
|
+
var _this_config_showCustomControls1;
|
|
4498
|
+
return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
|
|
4490
4499
|
}
|
|
4491
|
-
|
|
4492
|
-
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
|
|
4500
|
+
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
4493
4501
|
}
|
|
4494
4502
|
},
|
|
4495
4503
|
{
|
|
@@ -4597,6 +4605,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4597
4605
|
var _this, loadPromise;
|
|
4598
4606
|
return _ts_generator(this, function(_state) {
|
|
4599
4607
|
_this = this;
|
|
4608
|
+
if (this.isGamInCooldown()) {
|
|
4609
|
+
if (this.config.debugAdTiming) {
|
|
4610
|
+
console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping preload");
|
|
4611
|
+
}
|
|
4612
|
+
return [
|
|
4613
|
+
2
|
|
4614
|
+
];
|
|
4615
|
+
}
|
|
4600
4616
|
if (this.preloadPool.some(function(entry) {
|
|
4601
4617
|
return entry.vastUrl === vastUrl;
|
|
4602
4618
|
}) || this.failedVastUrls.has(vastUrl) || this.isUrlInCooldown(vastUrl)) {
|
|
@@ -4626,26 +4642,32 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4626
4642
|
case 1:
|
|
4627
4643
|
_state.trys.push([
|
|
4628
4644
|
1,
|
|
4629
|
-
|
|
4645
|
+
5,
|
|
4630
4646
|
,
|
|
4631
|
-
|
|
4647
|
+
6
|
|
4632
4648
|
]);
|
|
4633
4649
|
continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
|
|
4634
4650
|
preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
|
|
4635
4651
|
preloadIma.initialize();
|
|
4636
|
-
errorListener = function(payload) {
|
|
4652
|
+
errorListener = function errorListener(payload) {
|
|
4637
4653
|
hasAdError = true;
|
|
4638
4654
|
adErrorPayload = payload;
|
|
4639
4655
|
};
|
|
4640
4656
|
preloadIma.on("ad_error", errorListener);
|
|
4641
|
-
errorListenerCleanup = function() {
|
|
4657
|
+
errorListenerCleanup = function errorListenerCleanup() {
|
|
4642
4658
|
return preloadIma.off("ad_error", errorListener);
|
|
4643
4659
|
};
|
|
4644
4660
|
return [
|
|
4645
4661
|
4,
|
|
4646
|
-
|
|
4662
|
+
this.enforceGlobalRateLimit()
|
|
4647
4663
|
];
|
|
4648
4664
|
case 2:
|
|
4665
|
+
_state.sent();
|
|
4666
|
+
return [
|
|
4667
|
+
4,
|
|
4668
|
+
preloadIma.requestAds(vastUrl)
|
|
4669
|
+
];
|
|
4670
|
+
case 3:
|
|
4649
4671
|
_state.sent();
|
|
4650
4672
|
preloadIma.pause();
|
|
4651
4673
|
return [
|
|
@@ -4654,7 +4676,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4654
4676
|
return setTimeout(resolve, 1500);
|
|
4655
4677
|
})
|
|
4656
4678
|
];
|
|
4657
|
-
case
|
|
4679
|
+
case 4:
|
|
4658
4680
|
_state.sent();
|
|
4659
4681
|
preloadIma.pause();
|
|
4660
4682
|
if (hasAdError) {
|
|
@@ -4663,6 +4685,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4663
4685
|
errorListenerCleanup();
|
|
4664
4686
|
}
|
|
4665
4687
|
preloadIma.destroy();
|
|
4688
|
+
this.recordGamNoFill();
|
|
4666
4689
|
if (isNoFill) {
|
|
4667
4690
|
if (this.config.debugAdTiming) {
|
|
4668
4691
|
console.log("[PRELOAD-POOL] ⚠️ Ad preload returned no-fill: ".concat(vastUrl));
|
|
@@ -4689,7 +4712,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4689
4712
|
isReady: true,
|
|
4690
4713
|
loadPromise: Promise.resolve()
|
|
4691
4714
|
};
|
|
4692
|
-
lateErrorListener = function(payload) {
|
|
4715
|
+
lateErrorListener = function lateErrorListener(payload) {
|
|
4693
4716
|
var index = _this.preloadPool.findIndex(function(entry) {
|
|
4694
4717
|
return entry.vastUrl === vastUrl;
|
|
4695
4718
|
});
|
|
@@ -4700,7 +4723,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4700
4723
|
}
|
|
4701
4724
|
try {
|
|
4702
4725
|
preloadIma.destroy();
|
|
4703
|
-
} catch (
|
|
4726
|
+
} catch (unused) {}
|
|
4704
4727
|
}
|
|
4705
4728
|
};
|
|
4706
4729
|
preloadIma.on("ad_error", lateErrorListener);
|
|
@@ -4713,13 +4736,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4713
4736
|
}
|
|
4714
4737
|
return [
|
|
4715
4738
|
3,
|
|
4716
|
-
|
|
4739
|
+
6
|
|
4717
4740
|
];
|
|
4718
|
-
case
|
|
4741
|
+
case 5:
|
|
4719
4742
|
error = _state.sent();
|
|
4720
4743
|
if (errorListenerCleanup) {
|
|
4721
4744
|
errorListenerCleanup();
|
|
4722
4745
|
}
|
|
4746
|
+
this.recordGamNoFill();
|
|
4723
4747
|
if (this.config.debugAdTiming) {
|
|
4724
4748
|
console.warn("[PRELOAD-POOL] ⚠️ Failed to preload ad: ".concat(vastUrl), error);
|
|
4725
4749
|
}
|
|
@@ -4730,9 +4754,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4730
4754
|
}
|
|
4731
4755
|
return [
|
|
4732
4756
|
3,
|
|
4733
|
-
|
|
4757
|
+
6
|
|
4734
4758
|
];
|
|
4735
|
-
case
|
|
4759
|
+
case 6:
|
|
4736
4760
|
return [
|
|
4737
4761
|
2
|
|
4738
4762
|
];
|
|
@@ -4771,6 +4795,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4771
4795
|
3,
|
|
4772
4796
|
10
|
|
4773
4797
|
];
|
|
4798
|
+
if (this.isGamInCooldown()) {
|
|
4799
|
+
if (this.config.debugAdTiming) {
|
|
4800
|
+
console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping preload pool loop");
|
|
4801
|
+
}
|
|
4802
|
+
return [
|
|
4803
|
+
3,
|
|
4804
|
+
10
|
|
4805
|
+
];
|
|
4806
|
+
}
|
|
4774
4807
|
if (!(!this.inAdBreak && this.preloadPool.length >= this.maxPreloadPoolSize)) return [
|
|
4775
4808
|
3,
|
|
4776
4809
|
3
|
|
@@ -4803,7 +4836,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4803
4836
|
3,
|
|
4804
4837
|
8
|
|
4805
4838
|
];
|
|
4806
|
-
if (!this.preloadPoolActive) {
|
|
4839
|
+
if (!this.preloadPoolActive || this.isGamInCooldown()) {
|
|
4807
4840
|
return [
|
|
4808
4841
|
3,
|
|
4809
4842
|
8
|
|
@@ -5019,9 +5052,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5019
5052
|
case 1:
|
|
5020
5053
|
_state.trys.push([
|
|
5021
5054
|
1,
|
|
5022
|
-
|
|
5055
|
+
8,
|
|
5023
5056
|
,
|
|
5024
|
-
|
|
5057
|
+
14
|
|
5025
5058
|
]);
|
|
5026
5059
|
if (!(usePreloadedAd && preloadedController)) return [
|
|
5027
5060
|
3,
|
|
@@ -5057,15 +5090,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5057
5090
|
this.ima.setAdVolume(adVolume);
|
|
5058
5091
|
return [
|
|
5059
5092
|
3,
|
|
5060
|
-
|
|
5093
|
+
7
|
|
5061
5094
|
];
|
|
5062
5095
|
case 3:
|
|
5096
|
+
return [
|
|
5097
|
+
4,
|
|
5098
|
+
this.enforceGlobalRateLimit()
|
|
5099
|
+
];
|
|
5100
|
+
case 4:
|
|
5101
|
+
_state.sent();
|
|
5063
5102
|
this.lastAdRequestTime = Date.now();
|
|
5064
5103
|
return [
|
|
5065
5104
|
4,
|
|
5066
5105
|
this.ima.requestAds(firstAdUrl)
|
|
5067
5106
|
];
|
|
5068
|
-
case
|
|
5107
|
+
case 5:
|
|
5069
5108
|
_state.sent();
|
|
5070
5109
|
if (this.config.debugAdTiming) {
|
|
5071
5110
|
console.log("[CONTINUOUS-FETCH] \u2705 First ad request successful, starting playback");
|
|
@@ -5080,7 +5119,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5080
5119
|
4,
|
|
5081
5120
|
this.ima.play()
|
|
5082
5121
|
];
|
|
5083
|
-
case
|
|
5122
|
+
case 6:
|
|
5084
5123
|
_state.sent();
|
|
5085
5124
|
if (this.expectedAdBreakDurationMs != null) {
|
|
5086
5125
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -5088,36 +5127,36 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5088
5127
|
}
|
|
5089
5128
|
adVolume1 = currentMuted ? 0 : currentVolume;
|
|
5090
5129
|
this.ima.setAdVolume(adVolume1);
|
|
5091
|
-
_state.label =
|
|
5092
|
-
case
|
|
5130
|
+
_state.label = 7;
|
|
5131
|
+
case 7:
|
|
5093
5132
|
return [
|
|
5094
5133
|
3,
|
|
5095
|
-
|
|
5134
|
+
14
|
|
5096
5135
|
];
|
|
5097
|
-
case
|
|
5136
|
+
case 8:
|
|
5098
5137
|
error = _state.sent();
|
|
5099
5138
|
if (this.config.debugAdTiming) {
|
|
5100
5139
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F First ad request failed:", error);
|
|
5101
5140
|
}
|
|
5102
5141
|
if (!!usePreloadedAd) return [
|
|
5103
5142
|
3,
|
|
5104
|
-
|
|
5143
|
+
12
|
|
5105
5144
|
];
|
|
5106
5145
|
fallbackPreloaded = this.getPreloadedAd();
|
|
5107
5146
|
if (!fallbackPreloaded) return [
|
|
5108
5147
|
3,
|
|
5109
|
-
|
|
5148
|
+
12
|
|
5110
5149
|
];
|
|
5111
5150
|
if (this.config.debugAdTiming) {
|
|
5112
5151
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDD04 First ad failed, using preloaded fallback");
|
|
5113
5152
|
}
|
|
5114
|
-
_state.label =
|
|
5115
|
-
case
|
|
5153
|
+
_state.label = 9;
|
|
5154
|
+
case 9:
|
|
5116
5155
|
_state.trys.push([
|
|
5117
|
-
|
|
5118
|
-
|
|
5156
|
+
9,
|
|
5157
|
+
11,
|
|
5119
5158
|
,
|
|
5120
|
-
|
|
5159
|
+
12
|
|
5121
5160
|
]);
|
|
5122
5161
|
this.ima.destroy();
|
|
5123
5162
|
this.video.muted = true;
|
|
@@ -5136,7 +5175,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5136
5175
|
4,
|
|
5137
5176
|
this.ima.play()
|
|
5138
5177
|
];
|
|
5139
|
-
case
|
|
5178
|
+
case 10:
|
|
5140
5179
|
_state.sent();
|
|
5141
5180
|
if (this.expectedAdBreakDurationMs != null) {
|
|
5142
5181
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -5147,16 +5186,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5147
5186
|
return [
|
|
5148
5187
|
2
|
|
5149
5188
|
];
|
|
5150
|
-
case
|
|
5189
|
+
case 11:
|
|
5151
5190
|
fallbackError = _state.sent();
|
|
5152
5191
|
if (this.config.debugAdTiming) {
|
|
5153
5192
|
console.warn("[CONTINUOUS-FETCH] \u26A0\uFE0F Preloaded fallback also failed:", fallbackError);
|
|
5154
5193
|
}
|
|
5155
5194
|
return [
|
|
5156
5195
|
3,
|
|
5157
|
-
|
|
5196
|
+
12
|
|
5158
5197
|
];
|
|
5159
|
-
case
|
|
5198
|
+
case 12:
|
|
5160
5199
|
if (this.isTemporaryAdError(error)) {
|
|
5161
5200
|
this.temporaryFailureUrls.set(firstAdUrl, Date.now());
|
|
5162
5201
|
if (this.config.debugAdTiming) {
|
|
@@ -5174,13 +5213,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5174
5213
|
4,
|
|
5175
5214
|
this.tryNextAvailableAdWithRateLimit()
|
|
5176
5215
|
];
|
|
5177
|
-
case
|
|
5216
|
+
case 13:
|
|
5178
5217
|
_state.sent();
|
|
5179
5218
|
return [
|
|
5180
5219
|
3,
|
|
5181
|
-
|
|
5220
|
+
14
|
|
5182
5221
|
];
|
|
5183
|
-
case
|
|
5222
|
+
case 14:
|
|
5184
5223
|
return [
|
|
5185
5224
|
2
|
|
5186
5225
|
];
|
|
@@ -5231,6 +5270,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5231
5270
|
"break"
|
|
5232
5271
|
];
|
|
5233
5272
|
}
|
|
5273
|
+
if (_this.isGamInCooldown()) {
|
|
5274
|
+
if (_this.config.debugAdTiming) {
|
|
5275
|
+
console.log("[CIRCUIT-BREAKER] GAM in cooldown, stopping URL generation");
|
|
5276
|
+
}
|
|
5277
|
+
return [
|
|
5278
|
+
2,
|
|
5279
|
+
"break"
|
|
5280
|
+
];
|
|
5281
|
+
}
|
|
5234
5282
|
if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
|
|
5235
5283
|
if (_this.config.debugAdTiming) {
|
|
5236
5284
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
|
|
@@ -5427,6 +5475,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5427
5475
|
2
|
|
5428
5476
|
];
|
|
5429
5477
|
}
|
|
5478
|
+
if (this.isGamInCooldown()) {
|
|
5479
|
+
if (this.config.debugAdTiming) {
|
|
5480
|
+
console.log("[CIRCUIT-BREAKER] GAM in cooldown, ending ad break gracefully");
|
|
5481
|
+
}
|
|
5482
|
+
this.handleAdPodComplete();
|
|
5483
|
+
return [
|
|
5484
|
+
2
|
|
5485
|
+
];
|
|
5486
|
+
}
|
|
5430
5487
|
if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
|
|
5431
5488
|
if (this.config.debugAdTiming) {
|
|
5432
5489
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(this.consecutiveFailures, "), ending ad break"));
|
|
@@ -5623,6 +5680,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5623
5680
|
case 0:
|
|
5624
5681
|
remaining = this.getRemainingAdMs();
|
|
5625
5682
|
waitTime = Math.min(this.maxPlaceholderDurationMs, remaining);
|
|
5683
|
+
if (this.isGamInCooldown()) {
|
|
5684
|
+
if (this.config.debugAdTiming) {
|
|
5685
|
+
console.log("[CIRCUIT-BREAKER] GAM in cooldown, skipping placeholder wait");
|
|
5686
|
+
}
|
|
5687
|
+
this.handleAdPodComplete();
|
|
5688
|
+
return [
|
|
5689
|
+
2
|
|
5690
|
+
];
|
|
5691
|
+
}
|
|
5626
5692
|
if (this.consecutiveFailures >= this.maxConsecutiveFailures) {
|
|
5627
5693
|
if (this.config.debugAdTiming) {
|
|
5628
5694
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Skipping placeholder - too many consecutive failures");
|
|
@@ -5886,11 +5952,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5886
5952
|
{
|
|
5887
5953
|
key: "ensureAdStoppedByTimer",
|
|
5888
5954
|
value: function ensureAdStoppedByTimer() {
|
|
5955
|
+
var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
|
|
5889
5956
|
if (!this.inAdBreak) return;
|
|
5890
5957
|
this.adStopTimerId = void 0;
|
|
5891
5958
|
var adPlaying = this.ima.isAdPlaying();
|
|
5892
5959
|
var pendingAds = this.adPodQueue.length > 0;
|
|
5893
|
-
var _this_config_adBreakCheckIntervalMs;
|
|
5894
5960
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
5895
5961
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
5896
5962
|
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
|
|
@@ -5898,7 +5964,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5898
5964
|
if (this.currentAdBreakStartWallClockMs != null) {
|
|
5899
5965
|
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
5900
5966
|
}
|
|
5901
|
-
var _this_expectedAdBreakDurationMs;
|
|
5902
5967
|
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
5903
5968
|
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
5904
5969
|
var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
@@ -6012,6 +6077,73 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6012
6077
|
}
|
|
6013
6078
|
}
|
|
6014
6079
|
},
|
|
6080
|
+
{
|
|
6081
|
+
key: "isGamInCooldown",
|
|
6082
|
+
value: function isGamInCooldown() {
|
|
6083
|
+
return Date.now() < this.globalNoFillCooldownUntil;
|
|
6084
|
+
}
|
|
6085
|
+
},
|
|
6086
|
+
{
|
|
6087
|
+
key: "recordGamNoFill",
|
|
6088
|
+
value: function recordGamNoFill() {
|
|
6089
|
+
this.globalConsecutiveNoFills++;
|
|
6090
|
+
if (this.globalConsecutiveNoFills >= this.globalNoFillThreshold) {
|
|
6091
|
+
var exponent = this.globalConsecutiveNoFills - this.globalNoFillThreshold;
|
|
6092
|
+
var backoff = Math.min(this.globalNoFillBackoffBaseMs * Math.pow(2, exponent), this.globalNoFillBackoffMaxMs);
|
|
6093
|
+
this.globalNoFillCooldownUntil = Date.now() + backoff;
|
|
6094
|
+
if (this.config.debugAdTiming) {
|
|
6095
|
+
console.log("[CIRCUIT-BREAKER] GAM cooldown activated: ".concat(backoff, "ms (").concat(this.globalConsecutiveNoFills, " consecutive no-fills)"));
|
|
6096
|
+
}
|
|
6097
|
+
}
|
|
6098
|
+
}
|
|
6099
|
+
},
|
|
6100
|
+
{
|
|
6101
|
+
key: "resetGamNoFillCounter",
|
|
6102
|
+
value: function resetGamNoFillCounter() {
|
|
6103
|
+
if (this.globalConsecutiveNoFills > 0 && this.config.debugAdTiming) {
|
|
6104
|
+
console.log("[CIRCUIT-BREAKER] Resetting no-fill counter (was ".concat(this.globalConsecutiveNoFills, ")"));
|
|
6105
|
+
}
|
|
6106
|
+
this.globalConsecutiveNoFills = 0;
|
|
6107
|
+
this.globalNoFillCooldownUntil = 0;
|
|
6108
|
+
}
|
|
6109
|
+
},
|
|
6110
|
+
{
|
|
6111
|
+
key: "enforceGlobalRateLimit",
|
|
6112
|
+
value: function enforceGlobalRateLimit() {
|
|
6113
|
+
return _async_to_generator(function() {
|
|
6114
|
+
var now, elapsed, waitMs;
|
|
6115
|
+
return _ts_generator(this, function(_state) {
|
|
6116
|
+
switch(_state.label){
|
|
6117
|
+
case 0:
|
|
6118
|
+
now = Date.now();
|
|
6119
|
+
elapsed = now - this.globalLastGamRequestTime;
|
|
6120
|
+
if (!(elapsed < this.globalMinGamIntervalMs)) return [
|
|
6121
|
+
3,
|
|
6122
|
+
2
|
|
6123
|
+
];
|
|
6124
|
+
waitMs = this.globalMinGamIntervalMs - elapsed;
|
|
6125
|
+
if (this.config.debugAdTiming) {
|
|
6126
|
+
console.log("[RATE-LIMIT] Waiting ".concat(waitMs, "ms before next GAM request"));
|
|
6127
|
+
}
|
|
6128
|
+
return [
|
|
6129
|
+
4,
|
|
6130
|
+
new Promise(function(resolve) {
|
|
6131
|
+
return setTimeout(resolve, waitMs);
|
|
6132
|
+
})
|
|
6133
|
+
];
|
|
6134
|
+
case 1:
|
|
6135
|
+
_state.sent();
|
|
6136
|
+
_state.label = 2;
|
|
6137
|
+
case 2:
|
|
6138
|
+
this.globalLastGamRequestTime = Date.now();
|
|
6139
|
+
return [
|
|
6140
|
+
2
|
|
6141
|
+
];
|
|
6142
|
+
}
|
|
6143
|
+
});
|
|
6144
|
+
}).call(this);
|
|
6145
|
+
}
|
|
6146
|
+
},
|
|
6015
6147
|
{
|
|
6016
6148
|
key: "playSingleAd",
|
|
6017
6149
|
value: function playSingleAd(vastTagUrl) {
|
|
@@ -6043,6 +6175,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6043
6175
|
}
|
|
6044
6176
|
throw new Error("Too many consecutive failures");
|
|
6045
6177
|
}
|
|
6178
|
+
if (this.isGamInCooldown()) {
|
|
6179
|
+
if (this.config.debugAdTiming) {
|
|
6180
|
+
console.warn("[CIRCUIT-BREAKER] GAM in cooldown, skipping ad request");
|
|
6181
|
+
}
|
|
6182
|
+
throw new Error("GAM in cooldown");
|
|
6183
|
+
}
|
|
6046
6184
|
this.recreateImaController();
|
|
6047
6185
|
requestToken = ++this.adRequestTokenCounter;
|
|
6048
6186
|
this.activeAdRequestToken = requestToken;
|
|
@@ -6051,16 +6189,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6051
6189
|
case 1:
|
|
6052
6190
|
_state.trys.push([
|
|
6053
6191
|
1,
|
|
6054
|
-
|
|
6192
|
+
12,
|
|
6055
6193
|
,
|
|
6056
|
-
|
|
6194
|
+
17
|
|
6057
6195
|
]);
|
|
6196
|
+
return [
|
|
6197
|
+
4,
|
|
6198
|
+
this.enforceGlobalRateLimit()
|
|
6199
|
+
];
|
|
6200
|
+
case 2:
|
|
6201
|
+
_state.sent();
|
|
6058
6202
|
this.lastAdRequestTime = Date.now();
|
|
6059
6203
|
return [
|
|
6060
6204
|
4,
|
|
6061
6205
|
this.ima.requestAds(vastTagUrl)
|
|
6062
6206
|
];
|
|
6063
|
-
case
|
|
6207
|
+
case 3:
|
|
6064
6208
|
_state.sent();
|
|
6065
6209
|
this.clearAdRequestWatchdog();
|
|
6066
6210
|
if (this.activeAdRequestToken !== requestToken) {
|
|
@@ -6068,20 +6212,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6068
6212
|
2
|
|
6069
6213
|
];
|
|
6070
6214
|
}
|
|
6071
|
-
_state.label =
|
|
6072
|
-
case
|
|
6215
|
+
_state.label = 4;
|
|
6216
|
+
case 4:
|
|
6073
6217
|
_state.trys.push([
|
|
6074
|
-
|
|
6075
|
-
|
|
6218
|
+
4,
|
|
6219
|
+
6,
|
|
6076
6220
|
,
|
|
6077
|
-
|
|
6221
|
+
11
|
|
6078
6222
|
]);
|
|
6079
6223
|
this.startAdFailsafeTimer(requestToken);
|
|
6080
6224
|
return [
|
|
6081
6225
|
4,
|
|
6082
6226
|
this.ima.play()
|
|
6083
6227
|
];
|
|
6084
|
-
case
|
|
6228
|
+
case 5:
|
|
6085
6229
|
_state.sent();
|
|
6086
6230
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6087
6231
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -6095,9 +6239,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6095
6239
|
this.temporaryFailureUrls.delete(vastTagUrl);
|
|
6096
6240
|
return [
|
|
6097
6241
|
3,
|
|
6098
|
-
|
|
6242
|
+
11
|
|
6099
6243
|
];
|
|
6100
|
-
case
|
|
6244
|
+
case 6:
|
|
6101
6245
|
playError = _state.sent();
|
|
6102
6246
|
if (this.config.debugAdTiming) {
|
|
6103
6247
|
console.error("[AD-ERROR] Failed to play ad:", playError);
|
|
@@ -6105,18 +6249,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6105
6249
|
preloadedFallback = this.getPreloadedAd();
|
|
6106
6250
|
if (!preloadedFallback) return [
|
|
6107
6251
|
3,
|
|
6108
|
-
|
|
6252
|
+
10
|
|
6109
6253
|
];
|
|
6110
6254
|
if (this.config.debugAdTiming) {
|
|
6111
6255
|
console.log("[AD-ERROR] Play failed, trying preloaded fallback ad");
|
|
6112
6256
|
}
|
|
6113
|
-
_state.label =
|
|
6114
|
-
case
|
|
6257
|
+
_state.label = 7;
|
|
6258
|
+
case 7:
|
|
6115
6259
|
_state.trys.push([
|
|
6116
|
-
|
|
6117
|
-
|
|
6260
|
+
7,
|
|
6261
|
+
9,
|
|
6118
6262
|
,
|
|
6119
|
-
|
|
6263
|
+
10
|
|
6120
6264
|
]);
|
|
6121
6265
|
this.clearAdFailsafeTimer();
|
|
6122
6266
|
this.ima.destroy();
|
|
@@ -6132,7 +6276,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6132
6276
|
4,
|
|
6133
6277
|
this.ima.play()
|
|
6134
6278
|
];
|
|
6135
|
-
case
|
|
6279
|
+
case 8:
|
|
6136
6280
|
_state.sent();
|
|
6137
6281
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6138
6282
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -6145,16 +6289,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6145
6289
|
return [
|
|
6146
6290
|
2
|
|
6147
6291
|
];
|
|
6148
|
-
case
|
|
6292
|
+
case 9:
|
|
6149
6293
|
fallbackError = _state.sent();
|
|
6150
6294
|
if (this.config.debugAdTiming) {
|
|
6151
6295
|
console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError);
|
|
6152
6296
|
}
|
|
6153
6297
|
return [
|
|
6154
6298
|
3,
|
|
6155
|
-
|
|
6299
|
+
10
|
|
6156
6300
|
];
|
|
6157
|
-
case
|
|
6301
|
+
case 10:
|
|
6158
6302
|
if (this.isTemporaryAdError(playError)) {
|
|
6159
6303
|
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
6160
6304
|
if (this.config.debugAdTiming) {
|
|
@@ -6171,12 +6315,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6171
6315
|
this.activeAdRequestToken = null;
|
|
6172
6316
|
}
|
|
6173
6317
|
throw playError;
|
|
6174
|
-
case
|
|
6318
|
+
case 11:
|
|
6175
6319
|
return [
|
|
6176
6320
|
3,
|
|
6177
|
-
|
|
6321
|
+
17
|
|
6178
6322
|
];
|
|
6179
|
-
case
|
|
6323
|
+
case 12:
|
|
6180
6324
|
error = _state.sent();
|
|
6181
6325
|
errorMessage = (error === null || error === void 0 ? void 0 : error.message) || "";
|
|
6182
6326
|
if (this.config.debugAdTiming) {
|
|
@@ -6185,18 +6329,18 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6185
6329
|
preloadedFallback1 = this.getPreloadedAd();
|
|
6186
6330
|
if (!preloadedFallback1) return [
|
|
6187
6331
|
3,
|
|
6188
|
-
|
|
6332
|
+
16
|
|
6189
6333
|
];
|
|
6190
6334
|
if (this.config.debugAdTiming) {
|
|
6191
6335
|
console.log("[AD-ERROR] Request failed, trying preloaded fallback ad");
|
|
6192
6336
|
}
|
|
6193
|
-
_state.label =
|
|
6194
|
-
case
|
|
6337
|
+
_state.label = 13;
|
|
6338
|
+
case 13:
|
|
6195
6339
|
_state.trys.push([
|
|
6196
|
-
|
|
6197
|
-
|
|
6340
|
+
13,
|
|
6341
|
+
15,
|
|
6198
6342
|
,
|
|
6199
|
-
|
|
6343
|
+
16
|
|
6200
6344
|
]);
|
|
6201
6345
|
this.clearAdRequestWatchdog();
|
|
6202
6346
|
this.clearAdFailsafeTimer();
|
|
@@ -6213,7 +6357,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6213
6357
|
4,
|
|
6214
6358
|
this.ima.play()
|
|
6215
6359
|
];
|
|
6216
|
-
case
|
|
6360
|
+
case 14:
|
|
6217
6361
|
_state.sent();
|
|
6218
6362
|
currentMuted2 = this.video.muted;
|
|
6219
6363
|
currentVolume2 = this.video.volume;
|
|
@@ -6222,16 +6366,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6222
6366
|
return [
|
|
6223
6367
|
2
|
|
6224
6368
|
];
|
|
6225
|
-
case
|
|
6369
|
+
case 15:
|
|
6226
6370
|
fallbackError1 = _state.sent();
|
|
6227
6371
|
if (this.config.debugAdTiming) {
|
|
6228
6372
|
console.warn("[AD-ERROR] Preloaded fallback also failed:", fallbackError1);
|
|
6229
6373
|
}
|
|
6230
6374
|
return [
|
|
6231
6375
|
3,
|
|
6232
|
-
|
|
6376
|
+
16
|
|
6233
6377
|
];
|
|
6234
|
-
case
|
|
6378
|
+
case 16:
|
|
6235
6379
|
if (this.isTemporaryAdError(error)) {
|
|
6236
6380
|
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
6237
6381
|
if (this.config.debugAdTiming) {
|
|
@@ -6249,7 +6393,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6249
6393
|
this.activeAdRequestToken = null;
|
|
6250
6394
|
}
|
|
6251
6395
|
throw error;
|
|
6252
|
-
case
|
|
6396
|
+
case 17:
|
|
6253
6397
|
return [
|
|
6254
6398
|
2
|
|
6255
6399
|
];
|
|
@@ -6285,6 +6429,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6285
6429
|
this.currentAdIndex = 0;
|
|
6286
6430
|
this.totalAdsInBreak = 0;
|
|
6287
6431
|
this.consecutiveFailures = 0;
|
|
6432
|
+
this.globalConsecutiveNoFills = 0;
|
|
6288
6433
|
this.ima.stop().catch(function() {});
|
|
6289
6434
|
var restoredMuted = this.ima.getOriginalMutedState();
|
|
6290
6435
|
var restoredVolume = this.ima.getOriginalVolume();
|
|
@@ -6316,6 +6461,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6316
6461
|
key: "handleAdFailure",
|
|
6317
6462
|
value: function handleAdFailure() {
|
|
6318
6463
|
this.consecutiveFailures++;
|
|
6464
|
+
this.recordGamNoFill();
|
|
6319
6465
|
var remaining = this.getRemainingAdMs();
|
|
6320
6466
|
if (this.config.debugAdTiming) {
|
|
6321
6467
|
console.log("[CONTINUOUS-FETCH] Ad failure: remaining=".concat(remaining, "ms, queued ads=").concat(this.adRequestQueue.length, ", consecutiveFailures=").concat(this.consecutiveFailures), this.adRequestQueue.length > 0 ? {
|
|
@@ -6343,8 +6489,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6343
6489
|
key: "startAdRequestWatchdog",
|
|
6344
6490
|
value: function startAdRequestWatchdog(token) {
|
|
6345
6491
|
var _this = this;
|
|
6346
|
-
this.clearAdRequestWatchdog();
|
|
6347
6492
|
var _this_config_adFailsafeTimeoutMs;
|
|
6493
|
+
this.clearAdRequestWatchdog();
|
|
6348
6494
|
var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
6349
6495
|
this.adRequestWatchdogToken = token;
|
|
6350
6496
|
this.adRequestWatchdogId = window.setTimeout(function() {
|
|
@@ -6387,8 +6533,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6387
6533
|
key: "startAdFailsafeTimer",
|
|
6388
6534
|
value: function startAdFailsafeTimer(token) {
|
|
6389
6535
|
var _this = this;
|
|
6390
|
-
this.clearAdFailsafeTimer();
|
|
6391
6536
|
var _this_config_adFailsafeTimeoutMs;
|
|
6537
|
+
this.clearAdFailsafeTimer();
|
|
6392
6538
|
var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
6393
6539
|
this.adFailsafeToken = token;
|
|
6394
6540
|
this.adFailsafeTimerId = window.setTimeout(function() {
|
|
@@ -6768,21 +6914,21 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6768
6914
|
var _React_useState14 = _sliced_to_array(React.useState(false), 2), showLicenseWarning = _React_useState14[0], setShowLicenseWarning = _React_useState14[1];
|
|
6769
6915
|
var _React_useState15 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _React_useState15[0], setViewportWidth = _React_useState15[1];
|
|
6770
6916
|
var _React_useState16 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _React_useState16[0], setIsPortrait = _React_useState16[1];
|
|
6771
|
-
var getResponsiveScale = function() {
|
|
6917
|
+
var getResponsiveScale = function getResponsiveScale() {
|
|
6772
6918
|
if (viewportWidth < 480) return 0.7;
|
|
6773
6919
|
if (viewportWidth < 768) return 0.8;
|
|
6774
6920
|
if (viewportWidth < 1024) return 0.9;
|
|
6775
6921
|
return 1;
|
|
6776
6922
|
};
|
|
6777
6923
|
var responsiveScale = getResponsiveScale();
|
|
6778
|
-
var formatTime = function(seconds) {
|
|
6924
|
+
var formatTime = function formatTime(seconds) {
|
|
6779
6925
|
if (!isFinite(seconds)) return "0:00:00";
|
|
6780
6926
|
var hours = Math.floor(seconds / 3600);
|
|
6781
6927
|
var minutes = Math.floor(seconds % 3600 / 60);
|
|
6782
6928
|
var remainingSeconds = Math.floor(seconds % 60);
|
|
6783
6929
|
return "".concat(hours, ":").concat(minutes.toString().padStart(2, "0"), ":").concat(remainingSeconds.toString().padStart(2, "0"));
|
|
6784
6930
|
};
|
|
6785
|
-
var handlePlayPause = function() {
|
|
6931
|
+
var handlePlayPause = function handlePlayPause() {
|
|
6786
6932
|
if (videoRef.current) {
|
|
6787
6933
|
if (videoRef.current.paused) {
|
|
6788
6934
|
var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
|
|
@@ -6801,7 +6947,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6801
6947
|
}
|
|
6802
6948
|
}
|
|
6803
6949
|
};
|
|
6804
|
-
var handleCenterPlayClick = function() {
|
|
6950
|
+
var handleCenterPlayClick = function handleCenterPlayClick() {
|
|
6805
6951
|
if (videoRef.current && videoRef.current.paused) {
|
|
6806
6952
|
var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
|
|
6807
6953
|
if (hasValidSource) {
|
|
@@ -6815,7 +6961,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6815
6961
|
}
|
|
6816
6962
|
}
|
|
6817
6963
|
};
|
|
6818
|
-
var handleTimelineSeek = function(e) {
|
|
6964
|
+
var handleTimelineSeek = function handleTimelineSeek(e) {
|
|
6819
6965
|
if (videoRef.current && duration > 0 && isFinite(duration)) {
|
|
6820
6966
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
6821
6967
|
var clickX = e.clientX - rect.left;
|
|
@@ -6826,13 +6972,13 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6826
6972
|
}
|
|
6827
6973
|
}
|
|
6828
6974
|
};
|
|
6829
|
-
var handleVolumeChange = function(newVolume) {
|
|
6975
|
+
var handleVolumeChange = function handleVolumeChange(newVolume) {
|
|
6830
6976
|
if (playerRef.current && isFinite(newVolume)) {
|
|
6831
6977
|
var clampedVolume = Math.max(0, Math.min(1, newVolume));
|
|
6832
6978
|
playerRef.current.setVolume(clampedVolume);
|
|
6833
6979
|
}
|
|
6834
6980
|
};
|
|
6835
|
-
var handlePlaybackRateChange = function(rate) {
|
|
6981
|
+
var handlePlaybackRateChange = function handlePlaybackRateChange(rate) {
|
|
6836
6982
|
if (videoRef.current && isFinite(rate) && rate > 0) {
|
|
6837
6983
|
videoRef.current.playbackRate = rate;
|
|
6838
6984
|
}
|
|
@@ -6869,7 +7015,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6869
7015
|
if (playerRef.current) {
|
|
6870
7016
|
try {
|
|
6871
7017
|
playerRef.current.destroy();
|
|
6872
|
-
} catch (
|
|
7018
|
+
} catch (unused) {}
|
|
6873
7019
|
playerRef.current = null;
|
|
6874
7020
|
}
|
|
6875
7021
|
var cfg = {
|
|
@@ -6909,7 +7055,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6909
7055
|
return function() {
|
|
6910
7056
|
try {
|
|
6911
7057
|
player.destroy();
|
|
6912
|
-
} catch (
|
|
7058
|
+
} catch (unused) {}
|
|
6913
7059
|
playerRef.current = null;
|
|
6914
7060
|
};
|
|
6915
7061
|
}, [
|
|
@@ -6933,7 +7079,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6933
7079
|
]);
|
|
6934
7080
|
useEffect(function() {
|
|
6935
7081
|
if (!playerRef.current) return;
|
|
6936
|
-
var checkAdStatus = function() {
|
|
7082
|
+
var checkAdStatus = function checkAdStatus() {
|
|
6937
7083
|
if (playerRef.current) {
|
|
6938
7084
|
var _videoRef_current_dataset, _videoRef_current;
|
|
6939
7085
|
var showAdsFromMethod = playerRef.current.isShowingAds();
|
|
@@ -6963,7 +7109,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6963
7109
|
}, []);
|
|
6964
7110
|
useEffect(function() {
|
|
6965
7111
|
if (typeof window === "undefined" || !playerRef.current) return;
|
|
6966
|
-
var handleResize = function() {
|
|
7112
|
+
var handleResize = function handleResize() {
|
|
6967
7113
|
if (playerRef.current && videoRef.current) {
|
|
6968
7114
|
if (typeof playerRef.current.resize === "function") {
|
|
6969
7115
|
playerRef.current.resize();
|
|
@@ -6979,7 +7125,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6979
7125
|
}, []);
|
|
6980
7126
|
useEffect(function() {
|
|
6981
7127
|
if (!playerRef.current || !videoRef.current) return;
|
|
6982
|
-
var updateStates = function() {
|
|
7128
|
+
var updateStates = function updateStates() {
|
|
6983
7129
|
var _videoRef_current;
|
|
6984
7130
|
if (playerRef.current && videoRef.current) {
|
|
6985
7131
|
setIsMuted(playerRef.current.isMuted());
|
|
@@ -6996,7 +7142,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
6996
7142
|
setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
|
|
6997
7143
|
};
|
|
6998
7144
|
var interval = setInterval(updateStates, 200);
|
|
6999
|
-
var handleFullscreenChange = function() {
|
|
7145
|
+
var handleFullscreenChange = function handleFullscreenChange() {
|
|
7000
7146
|
var _videoRef_current;
|
|
7001
7147
|
setIsFullscreen(document.fullscreenElement === ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.parentElement));
|
|
7002
7148
|
};
|
|
@@ -7008,7 +7154,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7008
7154
|
}, []);
|
|
7009
7155
|
useEffect(function() {
|
|
7010
7156
|
if (!videoRef.current) return;
|
|
7011
|
-
var handleLoadedMetadata = function() {
|
|
7157
|
+
var handleLoadedMetadata = function handleLoadedMetadata() {
|
|
7012
7158
|
if (videoRef.current) {
|
|
7013
7159
|
var video2 = videoRef.current;
|
|
7014
7160
|
void video2.offsetHeight;
|
|
@@ -7018,19 +7164,19 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7018
7164
|
console.log("[StormcloudUI] Video event: loadedmetadata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
|
|
7019
7165
|
}
|
|
7020
7166
|
};
|
|
7021
|
-
var handleLoadedData = function() {
|
|
7167
|
+
var handleLoadedData = function handleLoadedData() {
|
|
7022
7168
|
if (debugAdTiming) {
|
|
7023
7169
|
var _videoRef_current;
|
|
7024
7170
|
console.log("[StormcloudUI] Video event: loadeddata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
|
|
7025
7171
|
}
|
|
7026
7172
|
};
|
|
7027
|
-
var handleLoadStart = function() {
|
|
7173
|
+
var handleLoadStart = function handleLoadStart() {
|
|
7028
7174
|
if (debugAdTiming) {
|
|
7029
7175
|
var _videoRef_current;
|
|
7030
7176
|
console.log("[StormcloudUI] Video event: loadstart, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
|
|
7031
7177
|
}
|
|
7032
7178
|
};
|
|
7033
|
-
var handleCanPlay = function() {
|
|
7179
|
+
var handleCanPlay = function handleCanPlay() {
|
|
7034
7180
|
setIsLoading(false);
|
|
7035
7181
|
if (bufferingTimeoutRef.current) {
|
|
7036
7182
|
clearTimeout(bufferingTimeoutRef.current);
|
|
@@ -7042,7 +7188,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7042
7188
|
console.log("[StormcloudUI] Video event: canplay, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
|
|
7043
7189
|
}
|
|
7044
7190
|
};
|
|
7045
|
-
var handleCanPlayThrough = function() {
|
|
7191
|
+
var handleCanPlayThrough = function handleCanPlayThrough() {
|
|
7046
7192
|
setIsLoading(false);
|
|
7047
7193
|
if (bufferingTimeoutRef.current) {
|
|
7048
7194
|
clearTimeout(bufferingTimeoutRef.current);
|
|
@@ -7054,7 +7200,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7054
7200
|
console.log("[StormcloudUI] Video event: canplaythrough, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
|
|
7055
7201
|
}
|
|
7056
7202
|
};
|
|
7057
|
-
var handleWaiting = function() {
|
|
7203
|
+
var handleWaiting = function handleWaiting() {
|
|
7058
7204
|
if (bufferingTimeoutRef.current) {
|
|
7059
7205
|
clearTimeout(bufferingTimeoutRef.current);
|
|
7060
7206
|
}
|
|
@@ -7070,7 +7216,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7070
7216
|
console.log("[StormcloudUI] Video event: waiting, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- buffering delay started (300ms)");
|
|
7071
7217
|
}
|
|
7072
7218
|
};
|
|
7073
|
-
var handlePlaying = function() {
|
|
7219
|
+
var handlePlaying = function handlePlaying() {
|
|
7074
7220
|
setIsLoading(false);
|
|
7075
7221
|
if (bufferingTimeoutRef.current) {
|
|
7076
7222
|
clearTimeout(bufferingTimeoutRef.current);
|
|
@@ -7083,7 +7229,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7083
7229
|
console.log("[StormcloudUI] Video event: playing, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- playback started, isLoading=false, isBuffering=false");
|
|
7084
7230
|
}
|
|
7085
7231
|
};
|
|
7086
|
-
var handlePause = function() {
|
|
7232
|
+
var handlePause = function handlePause() {
|
|
7087
7233
|
var _playerRef_current, _videoRef_current_dataset, _videoRef_current;
|
|
7088
7234
|
var isAdActive = ((_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.isShowingAds()) || ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : (_videoRef_current_dataset = _videoRef_current.dataset) === null || _videoRef_current_dataset === void 0 ? void 0 : _videoRef_current_dataset.stormcloudAdPlaying) === "true";
|
|
7089
7235
|
if (playerRef.current && !isAdActive) {
|
|
@@ -7092,7 +7238,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7092
7238
|
setShowCenterPlay(false);
|
|
7093
7239
|
}
|
|
7094
7240
|
};
|
|
7095
|
-
var handleEnded = function() {
|
|
7241
|
+
var handleEnded = function handleEnded() {
|
|
7096
7242
|
setShowCenterPlay(true);
|
|
7097
7243
|
};
|
|
7098
7244
|
var video = videoRef.current;
|
|
@@ -7250,14 +7396,14 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7250
7396
|
boxShadow: "0 12px 40px rgba(0, 0, 0, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.3)",
|
|
7251
7397
|
transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
7252
7398
|
},
|
|
7253
|
-
onMouseEnter: function(e) {
|
|
7399
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7254
7400
|
var target = e.currentTarget;
|
|
7255
7401
|
target.style.transform = "translate(-50%, -50%)";
|
|
7256
7402
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(40, 40, 40, 0.9) 100%)";
|
|
7257
7403
|
target.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
|
|
7258
7404
|
target.style.borderColor = "rgba(255, 255, 255, 0.9)";
|
|
7259
7405
|
},
|
|
7260
|
-
onMouseLeave: function(e) {
|
|
7406
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7261
7407
|
var target = e.currentTarget;
|
|
7262
7408
|
target.style.transform = "translate(-50%, -50%)";
|
|
7263
7409
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 20, 0.8) 100%)";
|
|
@@ -7364,12 +7510,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7364
7510
|
minWidth: "".concat(48 * responsiveScale, "px"),
|
|
7365
7511
|
minHeight: "".concat(48 * responsiveScale, "px")
|
|
7366
7512
|
},
|
|
7367
|
-
onMouseEnter: function(e) {
|
|
7513
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7368
7514
|
var target = e.target;
|
|
7369
7515
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
|
|
7370
7516
|
target.style.boxShadow = "0 12px 48px rgba(0, 0, 0, 0.6), 0 6px 24px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
|
|
7371
7517
|
},
|
|
7372
|
-
onMouseLeave: function(e) {
|
|
7518
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7373
7519
|
var target = e.target;
|
|
7374
7520
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
|
|
7375
7521
|
target.style.boxShadow = "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
|
|
@@ -7395,15 +7541,15 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7395
7541
|
padding: "8px",
|
|
7396
7542
|
margin: "-8px"
|
|
7397
7543
|
},
|
|
7398
|
-
onMouseEnter: function() {
|
|
7544
|
+
onMouseEnter: function onMouseEnter() {
|
|
7399
7545
|
return setShowVolumeSlider(true);
|
|
7400
7546
|
},
|
|
7401
|
-
onMouseLeave: function() {
|
|
7547
|
+
onMouseLeave: function onMouseLeave() {
|
|
7402
7548
|
return setShowVolumeSlider(false);
|
|
7403
7549
|
},
|
|
7404
7550
|
children: [
|
|
7405
7551
|
/* @__PURE__ */ jsx("button", {
|
|
7406
|
-
onClick: function() {
|
|
7552
|
+
onClick: function onClick() {
|
|
7407
7553
|
if (playerRef.current) {
|
|
7408
7554
|
playerRef.current.toggleMute();
|
|
7409
7555
|
}
|
|
@@ -7427,12 +7573,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7427
7573
|
minWidth: "".concat(44 * responsiveScale, "px"),
|
|
7428
7574
|
minHeight: "".concat(44 * responsiveScale, "px")
|
|
7429
7575
|
},
|
|
7430
|
-
onMouseEnter: function(e) {
|
|
7576
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7431
7577
|
var target = e.target;
|
|
7432
7578
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
|
|
7433
7579
|
target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
|
|
7434
7580
|
},
|
|
7435
|
-
onMouseLeave: function(e) {
|
|
7581
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7436
7582
|
var target = e.target;
|
|
7437
7583
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
|
|
7438
7584
|
target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
|
|
@@ -7468,10 +7614,10 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7468
7614
|
marginBottom: "-16px",
|
|
7469
7615
|
zIndex: 9
|
|
7470
7616
|
},
|
|
7471
|
-
onMouseEnter: function() {
|
|
7617
|
+
onMouseEnter: function onMouseEnter() {
|
|
7472
7618
|
return setShowVolumeSlider(true);
|
|
7473
7619
|
},
|
|
7474
|
-
onMouseLeave: function() {
|
|
7620
|
+
onMouseLeave: function onMouseLeave() {
|
|
7475
7621
|
return setShowVolumeSlider(false);
|
|
7476
7622
|
}
|
|
7477
7623
|
}),
|
|
@@ -7496,12 +7642,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7496
7642
|
zIndex: 10,
|
|
7497
7643
|
transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
|
|
7498
7644
|
},
|
|
7499
|
-
onMouseEnter: function(e) {
|
|
7645
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7500
7646
|
setShowVolumeSlider(true);
|
|
7501
7647
|
e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 24px rgba(59, 130, 246, 0.3)";
|
|
7502
7648
|
e.currentTarget.style.borderColor = "rgba(59, 130, 246, 0.4)";
|
|
7503
7649
|
},
|
|
7504
|
-
onMouseLeave: function(e) {
|
|
7650
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7505
7651
|
setShowVolumeSlider(false);
|
|
7506
7652
|
e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15)";
|
|
7507
7653
|
e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.15)";
|
|
@@ -7514,19 +7660,19 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7514
7660
|
cursor: "pointer",
|
|
7515
7661
|
transition: "transform 0.2s ease-in-out"
|
|
7516
7662
|
},
|
|
7517
|
-
onMouseEnter: function(e) {},
|
|
7518
|
-
onMouseLeave: function(e) {},
|
|
7519
|
-
onMouseDown: function(e) {
|
|
7663
|
+
onMouseEnter: function onMouseEnter(e) {},
|
|
7664
|
+
onMouseLeave: function onMouseLeave(e) {},
|
|
7665
|
+
onMouseDown: function onMouseDown(e) {
|
|
7520
7666
|
e.preventDefault();
|
|
7521
7667
|
var sliderElement = e.currentTarget;
|
|
7522
|
-
var handleMouseMove = function(moveEvent) {
|
|
7668
|
+
var handleMouseMove = function handleMouseMove(moveEvent) {
|
|
7523
7669
|
if (!sliderElement) return;
|
|
7524
7670
|
var rect2 = sliderElement.getBoundingClientRect();
|
|
7525
7671
|
var y2 = moveEvent.clientY - rect2.top;
|
|
7526
7672
|
var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
|
|
7527
7673
|
handleVolumeChange(percentage2);
|
|
7528
7674
|
};
|
|
7529
|
-
var handleMouseUp = function() {
|
|
7675
|
+
var handleMouseUp = function handleMouseUp1() {
|
|
7530
7676
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
7531
7677
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
7532
7678
|
};
|
|
@@ -7537,7 +7683,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7537
7683
|
var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
|
|
7538
7684
|
handleVolumeChange(percentage);
|
|
7539
7685
|
},
|
|
7540
|
-
onClick: function(e) {
|
|
7686
|
+
onClick: function onClick(e) {
|
|
7541
7687
|
e.stopPropagation();
|
|
7542
7688
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
7543
7689
|
var y = e.clientY - rect.top;
|
|
@@ -7584,17 +7730,17 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7584
7730
|
transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
|
|
7585
7731
|
cursor: "grab"
|
|
7586
7732
|
},
|
|
7587
|
-
onMouseEnter: function(e) {
|
|
7733
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7588
7734
|
e.currentTarget.style.boxShadow = "0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 20px rgba(59, 130, 246, 0.6)";
|
|
7589
7735
|
e.currentTarget.style.cursor = "grab";
|
|
7590
7736
|
},
|
|
7591
|
-
onMouseLeave: function(e) {
|
|
7737
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7592
7738
|
e.currentTarget.style.boxShadow = "0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(59, 130, 246, 0.3), 0 0 12px rgba(59, 130, 246, 0.4)";
|
|
7593
7739
|
},
|
|
7594
|
-
onMouseDown: function(e) {
|
|
7740
|
+
onMouseDown: function onMouseDown(e) {
|
|
7595
7741
|
e.currentTarget.style.cursor = "grabbing";
|
|
7596
7742
|
},
|
|
7597
|
-
onMouseUp: function(e) {
|
|
7743
|
+
onMouseUp: function onMouseUp(e) {
|
|
7598
7744
|
e.currentTarget.style.cursor = "grab";
|
|
7599
7745
|
}
|
|
7600
7746
|
})
|
|
@@ -7634,7 +7780,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7634
7780
|
},
|
|
7635
7781
|
children: [
|
|
7636
7782
|
/* @__PURE__ */ jsxs("button", {
|
|
7637
|
-
onClick: function() {
|
|
7783
|
+
onClick: function onClick() {
|
|
7638
7784
|
return setShowSpeedMenu(!showSpeedMenu);
|
|
7639
7785
|
},
|
|
7640
7786
|
style: {
|
|
@@ -7653,12 +7799,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7653
7799
|
minWidth: "".concat(56 * responsiveScale, "px"),
|
|
7654
7800
|
minHeight: "".concat(40 * responsiveScale, "px")
|
|
7655
7801
|
},
|
|
7656
|
-
onMouseEnter: function(e) {
|
|
7802
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7657
7803
|
var target = e.target;
|
|
7658
7804
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
|
|
7659
7805
|
target.style.boxShadow = "0 10px 32px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
|
|
7660
7806
|
},
|
|
7661
|
-
onMouseLeave: function(e) {
|
|
7807
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7662
7808
|
var target = e.target;
|
|
7663
7809
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
|
|
7664
7810
|
target.style.boxShadow = "0 6px 24px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
|
|
@@ -7694,7 +7840,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7694
7840
|
2
|
|
7695
7841
|
].map(function(speed) {
|
|
7696
7842
|
return /* @__PURE__ */ jsxs("button", {
|
|
7697
|
-
onClick: function() {
|
|
7843
|
+
onClick: function onClick() {
|
|
7698
7844
|
return handlePlaybackRateChange(speed);
|
|
7699
7845
|
},
|
|
7700
7846
|
style: {
|
|
@@ -7712,12 +7858,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7712
7858
|
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
7713
7859
|
borderBottom: speed !== 2 ? "1px solid rgba(255, 255, 255, 0.05)" : "none"
|
|
7714
7860
|
},
|
|
7715
|
-
onMouseEnter: function(e) {
|
|
7861
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7716
7862
|
if (playbackRate !== speed) {
|
|
7717
7863
|
e.target.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%)";
|
|
7718
7864
|
}
|
|
7719
7865
|
},
|
|
7720
|
-
onMouseLeave: function(e) {
|
|
7866
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7721
7867
|
if (playbackRate !== speed) {
|
|
7722
7868
|
e.target.style.background = "transparent";
|
|
7723
7869
|
}
|
|
@@ -7732,7 +7878,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7732
7878
|
]
|
|
7733
7879
|
}),
|
|
7734
7880
|
/* @__PURE__ */ jsx("button", {
|
|
7735
|
-
onClick: function() {
|
|
7881
|
+
onClick: function onClick() {
|
|
7736
7882
|
if (onFullscreenToggle) {
|
|
7737
7883
|
onFullscreenToggle();
|
|
7738
7884
|
} else if (playerRef.current) {
|
|
@@ -7757,12 +7903,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7757
7903
|
minWidth: "".concat(44 * responsiveScale, "px"),
|
|
7758
7904
|
minHeight: "".concat(44 * responsiveScale, "px")
|
|
7759
7905
|
},
|
|
7760
|
-
onMouseEnter: function(e) {
|
|
7906
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7761
7907
|
var target = e.target;
|
|
7762
7908
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.7) 100%)";
|
|
7763
7909
|
target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 5px 16px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.35)";
|
|
7764
7910
|
},
|
|
7765
|
-
onMouseLeave: function(e) {
|
|
7911
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7766
7912
|
var target = e.target;
|
|
7767
7913
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.6) 100%)";
|
|
7768
7914
|
target.style.boxShadow = "0 6px 28px rgba(0, 0, 0, 0.4), 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25)";
|
|
@@ -7806,15 +7952,15 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7806
7952
|
padding: "8px",
|
|
7807
7953
|
margin: "-8px"
|
|
7808
7954
|
},
|
|
7809
|
-
onMouseEnter: function() {
|
|
7955
|
+
onMouseEnter: function onMouseEnter() {
|
|
7810
7956
|
return setShowVolumeSlider(true);
|
|
7811
7957
|
},
|
|
7812
|
-
onMouseLeave: function() {
|
|
7958
|
+
onMouseLeave: function onMouseLeave() {
|
|
7813
7959
|
return setShowVolumeSlider(false);
|
|
7814
7960
|
},
|
|
7815
7961
|
children: [
|
|
7816
7962
|
/* @__PURE__ */ jsx("button", {
|
|
7817
|
-
onClick: function() {
|
|
7963
|
+
onClick: function onClick() {
|
|
7818
7964
|
if (playerRef.current) {
|
|
7819
7965
|
playerRef.current.toggleMute();
|
|
7820
7966
|
}
|
|
@@ -7822,12 +7968,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7822
7968
|
onVolumeToggle();
|
|
7823
7969
|
}
|
|
7824
7970
|
},
|
|
7825
|
-
onMouseEnter: function(e) {
|
|
7971
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7826
7972
|
var target = e.currentTarget;
|
|
7827
7973
|
target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
|
|
7828
7974
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
|
|
7829
7975
|
},
|
|
7830
|
-
onMouseLeave: function(e) {
|
|
7976
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7831
7977
|
var target = e.currentTarget;
|
|
7832
7978
|
target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
|
|
7833
7979
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
|
|
@@ -7882,10 +8028,10 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7882
8028
|
marginBottom: "-16px",
|
|
7883
8029
|
zIndex: 9
|
|
7884
8030
|
},
|
|
7885
|
-
onMouseEnter: function() {
|
|
8031
|
+
onMouseEnter: function onMouseEnter() {
|
|
7886
8032
|
return setShowVolumeSlider(true);
|
|
7887
8033
|
},
|
|
7888
|
-
onMouseLeave: function() {
|
|
8034
|
+
onMouseLeave: function onMouseLeave() {
|
|
7889
8035
|
return setShowVolumeSlider(false);
|
|
7890
8036
|
}
|
|
7891
8037
|
}),
|
|
@@ -7910,12 +8056,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7910
8056
|
zIndex: 10,
|
|
7911
8057
|
transition: "transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out"
|
|
7912
8058
|
},
|
|
7913
|
-
onMouseEnter: function(e) {
|
|
8059
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
7914
8060
|
setShowVolumeSlider(true);
|
|
7915
8061
|
e.currentTarget.style.boxShadow = "0 16px 48px rgba(0, 0, 0, 0.9), 0 6px 16px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 24px rgba(96, 165, 250, 0.4)";
|
|
7916
8062
|
e.currentTarget.style.borderColor = "rgba(96, 165, 250, 0.8)";
|
|
7917
8063
|
},
|
|
7918
|
-
onMouseLeave: function(e) {
|
|
8064
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
7919
8065
|
setShowVolumeSlider(false);
|
|
7920
8066
|
e.currentTarget.style.boxShadow = "0 12px 40px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35)";
|
|
7921
8067
|
e.currentTarget.style.borderColor = "rgba(255, 255, 255, 0.7)";
|
|
@@ -7928,17 +8074,17 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7928
8074
|
cursor: "pointer",
|
|
7929
8075
|
transition: "transform 0.2s ease-in-out"
|
|
7930
8076
|
},
|
|
7931
|
-
onMouseDown: function(e) {
|
|
8077
|
+
onMouseDown: function onMouseDown(e) {
|
|
7932
8078
|
e.preventDefault();
|
|
7933
8079
|
var sliderElement = e.currentTarget;
|
|
7934
|
-
var handleMouseMove = function(moveEvent) {
|
|
8080
|
+
var handleMouseMove = function handleMouseMove(moveEvent) {
|
|
7935
8081
|
if (!sliderElement) return;
|
|
7936
8082
|
var rect2 = sliderElement.getBoundingClientRect();
|
|
7937
8083
|
var y2 = moveEvent.clientY - rect2.top;
|
|
7938
8084
|
var percentage2 = 1 - Math.max(0, Math.min(1, y2 / rect2.height));
|
|
7939
8085
|
handleVolumeChange(percentage2);
|
|
7940
8086
|
};
|
|
7941
|
-
var handleMouseUp = function() {
|
|
8087
|
+
var handleMouseUp = function handleMouseUp1() {
|
|
7942
8088
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
7943
8089
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
7944
8090
|
};
|
|
@@ -7949,7 +8095,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7949
8095
|
var percentage = 1 - Math.max(0, Math.min(1, y / rect.height));
|
|
7950
8096
|
handleVolumeChange(percentage);
|
|
7951
8097
|
},
|
|
7952
|
-
onClick: function(e) {
|
|
8098
|
+
onClick: function onClick(e) {
|
|
7953
8099
|
e.stopPropagation();
|
|
7954
8100
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
7955
8101
|
var y = e.clientY - rect.top;
|
|
@@ -7998,17 +8144,17 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7998
8144
|
transition: "bottom 0.15s ease-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, width 0.2s ease-in-out, height 0.2s ease-in-out",
|
|
7999
8145
|
cursor: "grab"
|
|
8000
8146
|
},
|
|
8001
|
-
onMouseEnter: function(e) {
|
|
8147
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
8002
8148
|
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(96, 165, 250, 0.6), 0 0 24px rgba(96, 165, 250, 0.7)";
|
|
8003
8149
|
e.currentTarget.style.cursor = "grab";
|
|
8004
8150
|
},
|
|
8005
|
-
onMouseLeave: function(e) {
|
|
8151
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
8006
8152
|
e.currentTarget.style.boxShadow = "0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(96, 165, 250, 0.4), 0 0 16px rgba(96, 165, 250, 0.5)";
|
|
8007
8153
|
},
|
|
8008
|
-
onMouseDown: function(e) {
|
|
8154
|
+
onMouseDown: function onMouseDown(e) {
|
|
8009
8155
|
e.currentTarget.style.cursor = "grabbing";
|
|
8010
8156
|
},
|
|
8011
|
-
onMouseUp: function(e) {
|
|
8157
|
+
onMouseUp: function onMouseUp(e) {
|
|
8012
8158
|
e.currentTarget.style.cursor = "grab";
|
|
8013
8159
|
}
|
|
8014
8160
|
})
|
|
@@ -8020,7 +8166,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8020
8166
|
]
|
|
8021
8167
|
}),
|
|
8022
8168
|
/* @__PURE__ */ jsx("button", {
|
|
8023
|
-
onClick: function() {
|
|
8169
|
+
onClick: function onClick() {
|
|
8024
8170
|
if (onFullscreenToggle) {
|
|
8025
8171
|
onFullscreenToggle();
|
|
8026
8172
|
} else if (playerRef.current) {
|
|
@@ -8029,12 +8175,12 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8029
8175
|
});
|
|
8030
8176
|
}
|
|
8031
8177
|
},
|
|
8032
|
-
onMouseEnter: function(e) {
|
|
8178
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
8033
8179
|
var target = e.currentTarget;
|
|
8034
8180
|
target.style.boxShadow = "0 14px 48px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.8), inset 0 2px 0 rgba(255, 255, 255, 0.4)";
|
|
8035
8181
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.75) 100%)";
|
|
8036
8182
|
},
|
|
8037
|
-
onMouseLeave: function(e) {
|
|
8183
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
8038
8184
|
var target = e.currentTarget;
|
|
8039
8185
|
target.style.boxShadow = "0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3)";
|
|
8040
8186
|
target.style.background = "linear-gradient(135deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.65) 100%)";
|
|
@@ -8180,7 +8326,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8180
8326
|
// src/StormcloudPlayer.tsx
|
|
8181
8327
|
import React3, { Component as Component4, Suspense } from "react";
|
|
8182
8328
|
// src/props.ts
|
|
8183
|
-
var noop = function() {};
|
|
8329
|
+
var noop = function noop() {};
|
|
8184
8330
|
var defaultProps = {
|
|
8185
8331
|
playing: false,
|
|
8186
8332
|
loop: false,
|
|
@@ -8226,29 +8372,29 @@ var defaultProps = {
|
|
|
8226
8372
|
// src/utils.ts
|
|
8227
8373
|
import { lazy as reactLazy } from "react";
|
|
8228
8374
|
var lazy = reactLazy;
|
|
8229
|
-
var omit = function(object, keys) {
|
|
8375
|
+
var omit = function omit(object, keys) {
|
|
8230
8376
|
var result = _object_spread({}, object);
|
|
8231
8377
|
keys.forEach(function(key) {
|
|
8232
8378
|
delete result[key];
|
|
8233
8379
|
});
|
|
8234
8380
|
return result;
|
|
8235
8381
|
};
|
|
8236
|
-
var isMediaStream = function(url) {
|
|
8382
|
+
var isMediaStream = function isMediaStream(url) {
|
|
8237
8383
|
return typeof window !== "undefined" && window.MediaStream && _instanceof(url, window.MediaStream);
|
|
8238
8384
|
};
|
|
8239
|
-
var supportsWebKitPresentationMode = function() {
|
|
8385
|
+
var supportsWebKitPresentationMode = function supportsWebKitPresentationMode() {
|
|
8240
8386
|
if (typeof window === "undefined") return false;
|
|
8241
8387
|
var video = document.createElement("video");
|
|
8242
8388
|
return "webkitSupportsPresentationMode" in video;
|
|
8243
8389
|
};
|
|
8244
|
-
var randomString = function() {
|
|
8390
|
+
var randomString = function randomString() {
|
|
8245
8391
|
return Math.random().toString(36).substr(2, 9);
|
|
8246
8392
|
};
|
|
8247
|
-
var parseQuery = function(url) {
|
|
8393
|
+
var parseQuery = function parseQuery(url) {
|
|
8248
8394
|
var query = {};
|
|
8249
8395
|
var queryString = url.split("?")[1] || "";
|
|
8250
8396
|
if (!queryString) return query;
|
|
8251
|
-
var manualParse = function(qs) {
|
|
8397
|
+
var manualParse = function manualParse(qs) {
|
|
8252
8398
|
qs.split("&").forEach(function(param) {
|
|
8253
8399
|
var _param_split = _sliced_to_array(param.split("="), 2), key = _param_split[0], value = _param_split[1];
|
|
8254
8400
|
if (key) {
|
|
@@ -8275,7 +8421,7 @@ var parseQuery = function(url) {
|
|
|
8275
8421
|
}
|
|
8276
8422
|
return query;
|
|
8277
8423
|
};
|
|
8278
|
-
var merge = function(target) {
|
|
8424
|
+
var merge = function merge1(target) {
|
|
8279
8425
|
for(var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
8280
8426
|
sources[_key - 1] = arguments[_key];
|
|
8281
8427
|
}
|
|
@@ -8295,19 +8441,19 @@ var merge = function(target) {
|
|
|
8295
8441
|
target
|
|
8296
8442
|
].concat(_to_consumable_array(sources)));
|
|
8297
8443
|
};
|
|
8298
|
-
var isObject = function(item) {
|
|
8444
|
+
var isObject = function isObject(item) {
|
|
8299
8445
|
return item && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
|
|
8300
8446
|
};
|
|
8301
8447
|
var IS_BROWSER = typeof window !== "undefined" && window.document;
|
|
8302
8448
|
var IS_GLOBAL = typeof globalThis !== "undefined" && globalThis.window && globalThis.window.document;
|
|
8303
8449
|
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
8304
8450
|
var IS_SAFARI = IS_BROWSER && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
8305
|
-
var SUPPORTS_HLS = function() {
|
|
8451
|
+
var SUPPORTS_HLS = function SUPPORTS_HLS() {
|
|
8306
8452
|
if (!IS_BROWSER) return false;
|
|
8307
8453
|
var video = document.createElement("video");
|
|
8308
8454
|
return Boolean(video.canPlayType("application/vnd.apple.mpegurl"));
|
|
8309
8455
|
};
|
|
8310
|
-
var SUPPORTS_DASH = function() {
|
|
8456
|
+
var SUPPORTS_DASH = function SUPPORTS_DASH() {
|
|
8311
8457
|
if (!IS_BROWSER) return false;
|
|
8312
8458
|
var video = document.createElement("video");
|
|
8313
8459
|
return Boolean(video.canPlayType("application/dash+xml"));
|
|
@@ -8319,23 +8465,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
|
|
|
8319
8465
|
var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
|
|
8320
8466
|
var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
|
|
8321
8467
|
var canPlay = {
|
|
8322
|
-
hls: function(url) {
|
|
8468
|
+
hls: function hls(url) {
|
|
8323
8469
|
if (!url || typeof url !== "string") return false;
|
|
8324
8470
|
return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
|
|
8325
8471
|
},
|
|
8326
|
-
dash: function(url) {
|
|
8472
|
+
dash: function dash(url) {
|
|
8327
8473
|
if (!url || typeof url !== "string") return false;
|
|
8328
8474
|
return DASH_EXTENSIONS.test(url);
|
|
8329
8475
|
},
|
|
8330
|
-
video: function(url) {
|
|
8476
|
+
video: function video(url) {
|
|
8331
8477
|
if (!url || typeof url !== "string") return false;
|
|
8332
8478
|
return VIDEO_EXTENSIONS.test(url);
|
|
8333
8479
|
},
|
|
8334
|
-
audio: function(url) {
|
|
8480
|
+
audio: function audio(url) {
|
|
8335
8481
|
if (!url || typeof url !== "string") return false;
|
|
8336
8482
|
return AUDIO_EXTENSIONS.test(url);
|
|
8337
8483
|
},
|
|
8338
|
-
file: function(url) {
|
|
8484
|
+
file: function file(url) {
|
|
8339
8485
|
if (!url || typeof url !== "string") return false;
|
|
8340
8486
|
return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
|
|
8341
8487
|
}
|
|
@@ -8348,11 +8494,11 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
|
|
|
8348
8494
|
function HlsPlayer() {
|
|
8349
8495
|
_class_call_check(this, HlsPlayer);
|
|
8350
8496
|
var _this;
|
|
8351
|
-
var _this1
|
|
8352
|
-
_this = _call_super(this, HlsPlayer,
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8497
|
+
var _this1;
|
|
8498
|
+
_this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
|
|
8499
|
+
_this.player = null;
|
|
8500
|
+
_this.mounted = false;
|
|
8501
|
+
_this.load = function() {
|
|
8356
8502
|
return _async_to_generator(function() {
|
|
8357
8503
|
var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
|
|
8358
8504
|
return _ts_generator(this, function(_state) {
|
|
@@ -8425,87 +8571,87 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
|
|
|
8425
8571
|
});
|
|
8426
8572
|
})();
|
|
8427
8573
|
};
|
|
8428
|
-
|
|
8429
|
-
if (
|
|
8430
|
-
var video =
|
|
8574
|
+
_this.play = function() {
|
|
8575
|
+
if (_this.props.videoElement) {
|
|
8576
|
+
var video = _this.props.videoElement;
|
|
8431
8577
|
var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
|
|
8432
8578
|
if (hasValidSource) {
|
|
8433
8579
|
var _video_play, _this_props_onPlay, _this_props;
|
|
8434
8580
|
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
|
|
8435
8581
|
var _this_props_onError, _this_props;
|
|
8436
8582
|
console.error("[HlsPlayer] Failed to play:", error);
|
|
8437
|
-
(_this_props_onError = (_this_props =
|
|
8583
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
8438
8584
|
});
|
|
8439
|
-
(_this_props_onPlay = (_this_props =
|
|
8585
|
+
(_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
|
|
8440
8586
|
} else {
|
|
8441
8587
|
console.warn("[HlsPlayer] Cannot play: video has no valid source");
|
|
8442
8588
|
}
|
|
8443
8589
|
}
|
|
8444
8590
|
};
|
|
8445
|
-
|
|
8446
|
-
if (
|
|
8591
|
+
_this.pause = function() {
|
|
8592
|
+
if (_this.props.videoElement) {
|
|
8447
8593
|
var _this_props_onPause, _this_props;
|
|
8448
|
-
|
|
8449
|
-
(_this_props_onPause = (_this_props =
|
|
8594
|
+
_this.props.videoElement.pause();
|
|
8595
|
+
(_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
|
|
8450
8596
|
}
|
|
8451
8597
|
};
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
if (
|
|
8455
|
-
|
|
8598
|
+
_this.stop = function() {
|
|
8599
|
+
_this.pause();
|
|
8600
|
+
if (_this.props.videoElement) {
|
|
8601
|
+
_this.props.videoElement.currentTime = 0;
|
|
8456
8602
|
}
|
|
8457
8603
|
};
|
|
8458
|
-
|
|
8459
|
-
if (
|
|
8460
|
-
|
|
8604
|
+
_this.seekTo = function(seconds, keepPlaying) {
|
|
8605
|
+
if (_this.props.videoElement) {
|
|
8606
|
+
_this.props.videoElement.currentTime = seconds;
|
|
8461
8607
|
if (!keepPlaying) {
|
|
8462
|
-
|
|
8608
|
+
_this.pause();
|
|
8463
8609
|
}
|
|
8464
8610
|
}
|
|
8465
8611
|
};
|
|
8466
|
-
|
|
8467
|
-
if (
|
|
8468
|
-
|
|
8612
|
+
_this.setVolume = function(volume) {
|
|
8613
|
+
if (_this.props.videoElement) {
|
|
8614
|
+
_this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
|
|
8469
8615
|
}
|
|
8470
8616
|
};
|
|
8471
|
-
|
|
8472
|
-
if (
|
|
8473
|
-
|
|
8617
|
+
_this.mute = function() {
|
|
8618
|
+
if (_this.props.videoElement) {
|
|
8619
|
+
_this.props.videoElement.muted = true;
|
|
8474
8620
|
}
|
|
8475
8621
|
};
|
|
8476
|
-
|
|
8477
|
-
if (
|
|
8478
|
-
|
|
8622
|
+
_this.unmute = function() {
|
|
8623
|
+
if (_this.props.videoElement) {
|
|
8624
|
+
_this.props.videoElement.muted = false;
|
|
8479
8625
|
}
|
|
8480
8626
|
};
|
|
8481
|
-
|
|
8482
|
-
if (
|
|
8483
|
-
|
|
8627
|
+
_this.setPlaybackRate = function(rate) {
|
|
8628
|
+
if (_this.props.videoElement && rate > 0) {
|
|
8629
|
+
_this.props.videoElement.playbackRate = rate;
|
|
8484
8630
|
}
|
|
8485
8631
|
};
|
|
8486
|
-
|
|
8487
|
-
if (
|
|
8488
|
-
return
|
|
8632
|
+
_this.getDuration = function() {
|
|
8633
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
|
|
8634
|
+
return _this.props.videoElement.duration;
|
|
8489
8635
|
}
|
|
8490
8636
|
return null;
|
|
8491
8637
|
};
|
|
8492
|
-
|
|
8493
|
-
if (
|
|
8494
|
-
return
|
|
8638
|
+
_this.getCurrentTime = function() {
|
|
8639
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
|
|
8640
|
+
return _this.props.videoElement.currentTime;
|
|
8495
8641
|
}
|
|
8496
8642
|
return null;
|
|
8497
8643
|
};
|
|
8498
|
-
|
|
8499
|
-
if (
|
|
8500
|
-
return
|
|
8644
|
+
_this.getSecondsLoaded = function() {
|
|
8645
|
+
if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
|
|
8646
|
+
return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
|
|
8501
8647
|
}
|
|
8502
8648
|
return null;
|
|
8503
8649
|
};
|
|
8504
|
-
|
|
8650
|
+
_this.getInternalPlayer = function() {
|
|
8505
8651
|
var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
|
|
8506
|
-
if (key === "player") return
|
|
8507
|
-
if (key === "video") return
|
|
8508
|
-
if (key === "hls" &&
|
|
8652
|
+
if (key === "player") return _this.player;
|
|
8653
|
+
if (key === "video") return _this.props.videoElement;
|
|
8654
|
+
if (key === "hls" && _this.player) return _this.player.hls;
|
|
8509
8655
|
return null;
|
|
8510
8656
|
};
|
|
8511
8657
|
return _this;
|
|
@@ -8555,49 +8701,49 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
|
|
|
8555
8701
|
function FilePlayer() {
|
|
8556
8702
|
_class_call_check(this, FilePlayer);
|
|
8557
8703
|
var _this;
|
|
8558
|
-
var _this1
|
|
8559
|
-
_this = _call_super(this, FilePlayer,
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8704
|
+
var _this1;
|
|
8705
|
+
_this = _call_super(this, FilePlayer, arguments), _this1 = _this;
|
|
8706
|
+
_this.mounted = false;
|
|
8707
|
+
_this.ready = false;
|
|
8708
|
+
_this.load = function() {
|
|
8563
8709
|
var _this_props_onMount, _this_props;
|
|
8564
|
-
if (!
|
|
8565
|
-
var video =
|
|
8566
|
-
var handleLoadedMetadata = function() {
|
|
8567
|
-
if (
|
|
8710
|
+
if (!_this.props.videoElement || !_this.props.src) return;
|
|
8711
|
+
var video = _this.props.videoElement;
|
|
8712
|
+
var handleLoadedMetadata = function handleLoadedMetadata() {
|
|
8713
|
+
if (_this.mounted && !_this.ready) {
|
|
8568
8714
|
var _this_props_onReady, _this_props;
|
|
8569
|
-
|
|
8570
|
-
(_this_props_onReady = (_this_props =
|
|
8715
|
+
_this.ready = true;
|
|
8716
|
+
(_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
|
|
8571
8717
|
}
|
|
8572
8718
|
};
|
|
8573
|
-
var handlePlay = function() {
|
|
8574
|
-
if (
|
|
8719
|
+
var handlePlay = function handlePlay() {
|
|
8720
|
+
if (_this.mounted) {
|
|
8575
8721
|
var _this_props_onPlay, _this_props;
|
|
8576
|
-
(_this_props_onPlay = (_this_props =
|
|
8722
|
+
(_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
|
|
8577
8723
|
}
|
|
8578
8724
|
};
|
|
8579
|
-
var handlePause = function() {
|
|
8580
|
-
if (
|
|
8725
|
+
var handlePause = function handlePause() {
|
|
8726
|
+
if (_this.mounted) {
|
|
8581
8727
|
var _this_props_onPause, _this_props;
|
|
8582
|
-
(_this_props_onPause = (_this_props =
|
|
8728
|
+
(_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
|
|
8583
8729
|
}
|
|
8584
8730
|
};
|
|
8585
|
-
var handleEnded = function() {
|
|
8586
|
-
if (
|
|
8731
|
+
var handleEnded = function handleEnded() {
|
|
8732
|
+
if (_this.mounted) {
|
|
8587
8733
|
var _this_props_onEnded, _this_props;
|
|
8588
|
-
(_this_props_onEnded = (_this_props =
|
|
8734
|
+
(_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
|
|
8589
8735
|
}
|
|
8590
8736
|
};
|
|
8591
|
-
var handleError = function(error) {
|
|
8592
|
-
if (
|
|
8737
|
+
var handleError = function handleError(error) {
|
|
8738
|
+
if (_this.mounted) {
|
|
8593
8739
|
var _this_props_onError, _this_props;
|
|
8594
|
-
(_this_props_onError = (_this_props =
|
|
8740
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
8595
8741
|
}
|
|
8596
8742
|
};
|
|
8597
|
-
var handleLoadedData = function() {
|
|
8598
|
-
if (
|
|
8743
|
+
var handleLoadedData = function handleLoadedData() {
|
|
8744
|
+
if (_this.mounted) {
|
|
8599
8745
|
var _this_props_onLoaded, _this_props;
|
|
8600
|
-
(_this_props_onLoaded = (_this_props =
|
|
8746
|
+
(_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
|
|
8601
8747
|
}
|
|
8602
8748
|
};
|
|
8603
8749
|
video.addEventListener("loadedmetadata", handleLoadedMetadata);
|
|
@@ -8606,15 +8752,15 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
|
|
|
8606
8752
|
video.addEventListener("ended", handleEnded);
|
|
8607
8753
|
video.addEventListener("error", handleError);
|
|
8608
8754
|
video.addEventListener("loadeddata", handleLoadedData);
|
|
8609
|
-
video.src =
|
|
8610
|
-
if (
|
|
8611
|
-
if (
|
|
8612
|
-
if (
|
|
8613
|
-
if (
|
|
8614
|
-
if (
|
|
8615
|
-
if (
|
|
8616
|
-
if (
|
|
8617
|
-
(_this_props_onMount = (_this_props =
|
|
8755
|
+
video.src = _this.props.src;
|
|
8756
|
+
if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
|
|
8757
|
+
if (_this.props.muted !== void 0) video.muted = _this.props.muted;
|
|
8758
|
+
if (_this.props.loop !== void 0) video.loop = _this.props.loop;
|
|
8759
|
+
if (_this.props.controls !== void 0) video.controls = _this.props.controls;
|
|
8760
|
+
if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
|
|
8761
|
+
if (_this.props.preload !== void 0) video.preload = _this.props.preload;
|
|
8762
|
+
if (_this.props.poster !== void 0) video.poster = _this.props.poster;
|
|
8763
|
+
(_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
|
|
8618
8764
|
return function() {
|
|
8619
8765
|
video.removeEventListener("loadedmetadata", handleLoadedMetadata);
|
|
8620
8766
|
video.removeEventListener("play", handlePlay);
|
|
@@ -8624,90 +8770,90 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
|
|
|
8624
8770
|
video.removeEventListener("loadeddata", handleLoadedData);
|
|
8625
8771
|
};
|
|
8626
8772
|
};
|
|
8627
|
-
|
|
8628
|
-
if (
|
|
8629
|
-
var video =
|
|
8773
|
+
_this.play = function() {
|
|
8774
|
+
if (_this.props.videoElement) {
|
|
8775
|
+
var video = _this.props.videoElement;
|
|
8630
8776
|
var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
|
|
8631
8777
|
if (hasValidSource) {
|
|
8632
8778
|
var _video_play;
|
|
8633
8779
|
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
|
|
8634
8780
|
var _this_props_onError, _this_props;
|
|
8635
8781
|
console.error("[FilePlayer] Failed to play:", error);
|
|
8636
|
-
(_this_props_onError = (_this_props =
|
|
8782
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
8637
8783
|
});
|
|
8638
8784
|
} else {
|
|
8639
8785
|
console.warn("[FilePlayer] Cannot play: video has no valid source");
|
|
8640
8786
|
}
|
|
8641
8787
|
}
|
|
8642
8788
|
};
|
|
8643
|
-
|
|
8644
|
-
if (
|
|
8645
|
-
|
|
8789
|
+
_this.pause = function() {
|
|
8790
|
+
if (_this.props.videoElement) {
|
|
8791
|
+
_this.props.videoElement.pause();
|
|
8646
8792
|
}
|
|
8647
8793
|
};
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
if (
|
|
8651
|
-
|
|
8794
|
+
_this.stop = function() {
|
|
8795
|
+
_this.pause();
|
|
8796
|
+
if (_this.props.videoElement) {
|
|
8797
|
+
_this.props.videoElement.currentTime = 0;
|
|
8652
8798
|
}
|
|
8653
8799
|
};
|
|
8654
|
-
|
|
8655
|
-
if (
|
|
8656
|
-
|
|
8800
|
+
_this.seekTo = function(seconds, keepPlaying) {
|
|
8801
|
+
if (_this.props.videoElement) {
|
|
8802
|
+
_this.props.videoElement.currentTime = seconds;
|
|
8657
8803
|
if (!keepPlaying) {
|
|
8658
|
-
|
|
8804
|
+
_this.pause();
|
|
8659
8805
|
}
|
|
8660
8806
|
}
|
|
8661
8807
|
};
|
|
8662
|
-
|
|
8663
|
-
if (
|
|
8664
|
-
|
|
8808
|
+
_this.setVolume = function(volume) {
|
|
8809
|
+
if (_this.props.videoElement) {
|
|
8810
|
+
_this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
|
|
8665
8811
|
}
|
|
8666
8812
|
};
|
|
8667
|
-
|
|
8668
|
-
if (
|
|
8669
|
-
|
|
8813
|
+
_this.mute = function() {
|
|
8814
|
+
if (_this.props.videoElement) {
|
|
8815
|
+
_this.props.videoElement.muted = true;
|
|
8670
8816
|
}
|
|
8671
8817
|
};
|
|
8672
|
-
|
|
8673
|
-
if (
|
|
8674
|
-
|
|
8818
|
+
_this.unmute = function() {
|
|
8819
|
+
if (_this.props.videoElement) {
|
|
8820
|
+
_this.props.videoElement.muted = false;
|
|
8675
8821
|
}
|
|
8676
8822
|
};
|
|
8677
|
-
|
|
8678
|
-
if (
|
|
8679
|
-
|
|
8823
|
+
_this.setPlaybackRate = function(rate) {
|
|
8824
|
+
if (_this.props.videoElement && rate > 0) {
|
|
8825
|
+
_this.props.videoElement.playbackRate = rate;
|
|
8680
8826
|
}
|
|
8681
8827
|
};
|
|
8682
|
-
|
|
8683
|
-
if (
|
|
8684
|
-
|
|
8828
|
+
_this.setLoop = function(loop) {
|
|
8829
|
+
if (_this.props.videoElement) {
|
|
8830
|
+
_this.props.videoElement.loop = loop;
|
|
8685
8831
|
}
|
|
8686
8832
|
};
|
|
8687
|
-
|
|
8688
|
-
if (
|
|
8689
|
-
return
|
|
8833
|
+
_this.getDuration = function() {
|
|
8834
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
|
|
8835
|
+
return _this.props.videoElement.duration;
|
|
8690
8836
|
}
|
|
8691
8837
|
return null;
|
|
8692
8838
|
};
|
|
8693
|
-
|
|
8694
|
-
if (
|
|
8695
|
-
return
|
|
8839
|
+
_this.getCurrentTime = function() {
|
|
8840
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
|
|
8841
|
+
return _this.props.videoElement.currentTime;
|
|
8696
8842
|
}
|
|
8697
8843
|
return null;
|
|
8698
8844
|
};
|
|
8699
|
-
|
|
8700
|
-
if (
|
|
8701
|
-
return
|
|
8845
|
+
_this.getSecondsLoaded = function() {
|
|
8846
|
+
if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
|
|
8847
|
+
return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
|
|
8702
8848
|
}
|
|
8703
8849
|
return null;
|
|
8704
8850
|
};
|
|
8705
|
-
|
|
8851
|
+
_this.getInternalPlayer = function() {
|
|
8706
8852
|
var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
|
|
8707
|
-
if (key === "video") return
|
|
8853
|
+
if (key === "video") return _this.props.videoElement;
|
|
8708
8854
|
return null;
|
|
8709
8855
|
};
|
|
8710
|
-
|
|
8856
|
+
_this.enablePIP = function() {
|
|
8711
8857
|
return _async_to_generator(function() {
|
|
8712
8858
|
var error;
|
|
8713
8859
|
return _ts_generator(this, function(_state) {
|
|
@@ -8750,7 +8896,7 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
|
|
|
8750
8896
|
});
|
|
8751
8897
|
})();
|
|
8752
8898
|
};
|
|
8753
|
-
|
|
8899
|
+
_this.disablePIP = function() {
|
|
8754
8900
|
return _async_to_generator(function() {
|
|
8755
8901
|
var error;
|
|
8756
8902
|
return _ts_generator(this, function(_state) {
|
|
@@ -8844,7 +8990,7 @@ var players = [
|
|
|
8844
8990
|
key: "file",
|
|
8845
8991
|
name: "File Player",
|
|
8846
8992
|
canPlay: canPlay.file,
|
|
8847
|
-
canEnablePIP: function(url) {
|
|
8993
|
+
canEnablePIP: function canEnablePIP(url) {
|
|
8848
8994
|
return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
|
|
8849
8995
|
},
|
|
8850
8996
|
lazyPlayer: lazy(function() {
|
|
@@ -9171,7 +9317,7 @@ var SUPPORTED_PROPS = [
|
|
|
9171
9317
|
"onControlClick"
|
|
9172
9318
|
];
|
|
9173
9319
|
var customPlayers = [];
|
|
9174
|
-
var createStormcloudPlayer = function(playerList, fallback) {
|
|
9320
|
+
var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallback) {
|
|
9175
9321
|
var _a;
|
|
9176
9322
|
return _a = /*#__PURE__*/ function(Component4) {
|
|
9177
9323
|
"use strict";
|
|
@@ -9184,10 +9330,10 @@ var createStormcloudPlayer = function(playerList, fallback) {
|
|
|
9184
9330
|
showPreview: false
|
|
9185
9331
|
};
|
|
9186
9332
|
_this.references = {
|
|
9187
|
-
wrapper: function(wrapper) {
|
|
9333
|
+
wrapper: function wrapper(wrapper) {
|
|
9188
9334
|
_this.wrapper = wrapper;
|
|
9189
9335
|
},
|
|
9190
|
-
player: function(player) {
|
|
9336
|
+
player: function player(player) {
|
|
9191
9337
|
_this.player = player;
|
|
9192
9338
|
}
|
|
9193
9339
|
};
|