stormcloud-video-player 0.3.65 → 0.3.67
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 +128 -42
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +23 -19
- package/lib/index.d.ts +23 -19
- package/lib/index.js +129 -43
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +69 -38
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +4 -0
- package/lib/players/HlsPlayer.cjs +69 -38
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +69 -38
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +131 -42
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -2,6 +2,25 @@ import React, { CSSProperties, lazy as lazy$1 } from 'react';
|
|
|
2
2
|
import * as csstype from 'csstype';
|
|
3
3
|
import Hls from 'hls.js';
|
|
4
4
|
|
|
5
|
+
declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
|
|
6
|
+
type MQTTConfig = {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
brokerAddress: string;
|
|
9
|
+
brokerPort: number;
|
|
10
|
+
wsPort: number;
|
|
11
|
+
username: string;
|
|
12
|
+
password: string;
|
|
13
|
+
topicPrefix: string;
|
|
14
|
+
qos: 0 | 1 | 2;
|
|
15
|
+
brokerUrl?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
|
|
18
|
+
declare const mqttConfig: MQTTConfig;
|
|
19
|
+
declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
|
|
20
|
+
declare function isMQTTEnabled(): boolean;
|
|
21
|
+
declare function buildMQTTBrokerUrl(): string;
|
|
22
|
+
declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
|
|
23
|
+
|
|
5
24
|
type LateJoinPolicy = "play_remaining" | "skip_to_content";
|
|
6
25
|
interface AdBreak {
|
|
7
26
|
id?: string;
|
|
@@ -213,6 +232,7 @@ declare class StormcloudVideoPlayer {
|
|
|
213
232
|
private preloadPoolActive;
|
|
214
233
|
private preloadPoolLoopRunning;
|
|
215
234
|
private adDetectSentForCurrentBreak;
|
|
235
|
+
private preAdBreakAudio;
|
|
216
236
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
217
237
|
private createAdPlayer;
|
|
218
238
|
load(): Promise<void>;
|
|
@@ -270,6 +290,7 @@ declare class StormcloudVideoPlayer {
|
|
|
270
290
|
private initializeTracking;
|
|
271
291
|
private sendHeartbeatIfNeeded;
|
|
272
292
|
private isVmapEnabled;
|
|
293
|
+
private applyMqttConfigFromResponse;
|
|
273
294
|
private fetchAdConfiguration;
|
|
274
295
|
private fetchAndParseVmap;
|
|
275
296
|
private parseVmapToBreaks;
|
|
@@ -319,6 +340,8 @@ declare class StormcloudVideoPlayer {
|
|
|
319
340
|
private resetGamNoFillCounter;
|
|
320
341
|
private enforceGlobalRateLimit;
|
|
321
342
|
private playSingleAd;
|
|
343
|
+
private capturePreAdBreakAudio;
|
|
344
|
+
private getPreAdBreakAdVolume;
|
|
322
345
|
private handleAdPodComplete;
|
|
323
346
|
private handleAdFailure;
|
|
324
347
|
private startAdRequestWatchdog;
|
|
@@ -4084,25 +4107,6 @@ declare function sendAdLoadedTracking(licenseKey: string | undefined, adLoadedIn
|
|
|
4084
4107
|
declare function sendAdImpressionTracking(licenseKey: string | undefined, adImpressionInfo: AdImpressionInfo, context?: PlayerAnalyticsContext): Promise<void>;
|
|
4085
4108
|
declare function sendHeartbeat(licenseKey?: string, context?: PlayerAnalyticsContext, flags?: PlayerMetricFlags): Promise<void>;
|
|
4086
4109
|
|
|
4087
|
-
declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
|
|
4088
|
-
type MQTTConfig = {
|
|
4089
|
-
enabled: boolean;
|
|
4090
|
-
brokerAddress: string;
|
|
4091
|
-
brokerPort: number;
|
|
4092
|
-
wsPort: number;
|
|
4093
|
-
username: string;
|
|
4094
|
-
password: string;
|
|
4095
|
-
topicPrefix: string;
|
|
4096
|
-
qos: 0 | 1 | 2;
|
|
4097
|
-
brokerUrl?: string;
|
|
4098
|
-
};
|
|
4099
|
-
declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
|
|
4100
|
-
declare const mqttConfig: MQTTConfig;
|
|
4101
|
-
declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
|
|
4102
|
-
declare function isMQTTEnabled(): boolean;
|
|
4103
|
-
declare function buildMQTTBrokerUrl(): string;
|
|
4104
|
-
declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
|
|
4105
|
-
|
|
4106
4110
|
type MQTTStatus = "disconnected" | "connecting" | "connected" | "error";
|
|
4107
4111
|
declare function getMQTTStatus(): MQTTStatus;
|
|
4108
4112
|
declare function isMQTTConnected(): boolean;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,25 @@ import React, { CSSProperties, lazy as lazy$1 } from 'react';
|
|
|
2
2
|
import * as csstype from 'csstype';
|
|
3
3
|
import Hls from 'hls.js';
|
|
4
4
|
|
|
5
|
+
declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
|
|
6
|
+
type MQTTConfig = {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
brokerAddress: string;
|
|
9
|
+
brokerPort: number;
|
|
10
|
+
wsPort: number;
|
|
11
|
+
username: string;
|
|
12
|
+
password: string;
|
|
13
|
+
topicPrefix: string;
|
|
14
|
+
qos: 0 | 1 | 2;
|
|
15
|
+
brokerUrl?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
|
|
18
|
+
declare const mqttConfig: MQTTConfig;
|
|
19
|
+
declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
|
|
20
|
+
declare function isMQTTEnabled(): boolean;
|
|
21
|
+
declare function buildMQTTBrokerUrl(): string;
|
|
22
|
+
declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
|
|
23
|
+
|
|
5
24
|
type LateJoinPolicy = "play_remaining" | "skip_to_content";
|
|
6
25
|
interface AdBreak {
|
|
7
26
|
id?: string;
|
|
@@ -213,6 +232,7 @@ declare class StormcloudVideoPlayer {
|
|
|
213
232
|
private preloadPoolActive;
|
|
214
233
|
private preloadPoolLoopRunning;
|
|
215
234
|
private adDetectSentForCurrentBreak;
|
|
235
|
+
private preAdBreakAudio;
|
|
216
236
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
217
237
|
private createAdPlayer;
|
|
218
238
|
load(): Promise<void>;
|
|
@@ -270,6 +290,7 @@ declare class StormcloudVideoPlayer {
|
|
|
270
290
|
private initializeTracking;
|
|
271
291
|
private sendHeartbeatIfNeeded;
|
|
272
292
|
private isVmapEnabled;
|
|
293
|
+
private applyMqttConfigFromResponse;
|
|
273
294
|
private fetchAdConfiguration;
|
|
274
295
|
private fetchAndParseVmap;
|
|
275
296
|
private parseVmapToBreaks;
|
|
@@ -319,6 +340,8 @@ declare class StormcloudVideoPlayer {
|
|
|
319
340
|
private resetGamNoFillCounter;
|
|
320
341
|
private enforceGlobalRateLimit;
|
|
321
342
|
private playSingleAd;
|
|
343
|
+
private capturePreAdBreakAudio;
|
|
344
|
+
private getPreAdBreakAdVolume;
|
|
322
345
|
private handleAdPodComplete;
|
|
323
346
|
private handleAdFailure;
|
|
324
347
|
private startAdRequestWatchdog;
|
|
@@ -4084,25 +4107,6 @@ declare function sendAdLoadedTracking(licenseKey: string | undefined, adLoadedIn
|
|
|
4084
4107
|
declare function sendAdImpressionTracking(licenseKey: string | undefined, adImpressionInfo: AdImpressionInfo, context?: PlayerAnalyticsContext): Promise<void>;
|
|
4085
4108
|
declare function sendHeartbeat(licenseKey?: string, context?: PlayerAnalyticsContext, flags?: PlayerMetricFlags): Promise<void>;
|
|
4086
4109
|
|
|
4087
|
-
declare const MQTT_CA_CERT_FILE = "src/certs/emqxsl-ca.crt";
|
|
4088
|
-
type MQTTConfig = {
|
|
4089
|
-
enabled: boolean;
|
|
4090
|
-
brokerAddress: string;
|
|
4091
|
-
brokerPort: number;
|
|
4092
|
-
wsPort: number;
|
|
4093
|
-
username: string;
|
|
4094
|
-
password: string;
|
|
4095
|
-
topicPrefix: string;
|
|
4096
|
-
qos: 0 | 1 | 2;
|
|
4097
|
-
brokerUrl?: string;
|
|
4098
|
-
};
|
|
4099
|
-
declare const DEFAULT_MQTT_CONFIG: MQTTConfig;
|
|
4100
|
-
declare const mqttConfig: MQTTConfig;
|
|
4101
|
-
declare function applyMQTTConfig(overrides: Partial<MQTTConfig>): void;
|
|
4102
|
-
declare function isMQTTEnabled(): boolean;
|
|
4103
|
-
declare function buildMQTTBrokerUrl(): string;
|
|
4104
|
-
declare function buildPlayerTopic(licenseKey: string, channel: "metrics" | "impressions" | "heartbeat"): string;
|
|
4105
|
-
|
|
4106
4110
|
type MQTTStatus = "disconnected" | "connecting" | "connected" | "error";
|
|
4107
4111
|
declare function getMQTTStatus(): MQTTStatus;
|
|
4108
4112
|
declare function isMQTTConnected(): boolean;
|
package/lib/index.js
CHANGED
|
@@ -3910,10 +3910,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3910
3910
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3911
3911
|
}
|
|
3912
3912
|
}
|
|
3913
|
-
|
|
3914
|
-
var currentVolume = _this.video.volume;
|
|
3915
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
3916
|
-
_this.ima.setAdVolume(adVolume);
|
|
3913
|
+
_this.ima.setAdVolume(_this.getPreAdBreakAdVolume());
|
|
3917
3914
|
if (_this.isShowingPlaceholder) {
|
|
3918
3915
|
if (_this.config.debugAdTiming) {
|
|
3919
3916
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -4667,6 +4664,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4667
4664
|
{
|
|
4668
4665
|
key: "startScte35AdBreak",
|
|
4669
4666
|
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4667
|
+
this.capturePreAdBreakAudio();
|
|
4670
4668
|
if (!this.video.muted) {
|
|
4671
4669
|
this.video.muted = true;
|
|
4672
4670
|
this.video.volume = 0;
|
|
@@ -5442,6 +5440,20 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5442
5440
|
return !!(this.config.isVmap && ((_this_config_vmapUrl = this.config.vmapUrl) === null || _this_config_vmapUrl === void 0 ? void 0 : _this_config_vmapUrl.trim()));
|
|
5443
5441
|
}
|
|
5444
5442
|
},
|
|
5443
|
+
{
|
|
5444
|
+
key: "applyMqttConfigFromResponse",
|
|
5445
|
+
value: function applyMqttConfigFromResponse(data) {
|
|
5446
|
+
var _data_response;
|
|
5447
|
+
var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
|
|
5448
|
+
if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
|
|
5449
|
+
return;
|
|
5450
|
+
}
|
|
5451
|
+
applyMQTTConfig(mqttConfig2);
|
|
5452
|
+
if (this.config.debugAdTiming) {
|
|
5453
|
+
console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
},
|
|
5445
5457
|
{
|
|
5446
5458
|
key: "fetchAdConfiguration",
|
|
5447
5459
|
value: function fetchAdConfiguration() {
|
|
@@ -5528,6 +5540,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5528
5540
|
];
|
|
5529
5541
|
case 4:
|
|
5530
5542
|
data = _state.sent();
|
|
5543
|
+
this.applyMqttConfigFromResponse(data);
|
|
5531
5544
|
imaPayload = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : (_data_response_ima = _data_response.ima) === null || _data_response_ima === void 0 ? void 0 : (_data_response_ima_publisherdeskima = _data_response_ima["publisherdesk.ima"]) === null || _data_response_ima_publisherdeskima === void 0 ? void 0 : _data_response_ima_publisherdeskima.payload;
|
|
5532
5545
|
if (imaPayload) {
|
|
5533
5546
|
this.apiVastTagUrl = decodeURIComponent(imaPayload);
|
|
@@ -6333,9 +6346,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6333
6346
|
this.continuousFetchingActive = true;
|
|
6334
6347
|
this.isShowingPlaceholder = false;
|
|
6335
6348
|
this.totalAdRequestsInBreak = 0;
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
this.
|
|
6349
|
+
this.capturePreAdBreakAudio();
|
|
6350
|
+
currentMuted = this.preAdBreakAudio.muted;
|
|
6351
|
+
currentVolume = this.preAdBreakAudio.volume;
|
|
6339
6352
|
if (!this.video.muted) {
|
|
6340
6353
|
this.video.muted = true;
|
|
6341
6354
|
this.video.volume = 0;
|
|
@@ -6810,7 +6823,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6810
6823
|
value: function tryNextAvailableAd() {
|
|
6811
6824
|
var retryCount = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
6812
6825
|
return _async_to_generator(function() {
|
|
6813
|
-
var remaining, preloaded,
|
|
6826
|
+
var remaining, preloaded, error, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error1, errorMessage, maxRetries;
|
|
6814
6827
|
return _ts_generator(this, function(_state) {
|
|
6815
6828
|
switch(_state.label){
|
|
6816
6829
|
case 0:
|
|
@@ -6882,10 +6895,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6882
6895
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6883
6896
|
this.scheduleAdStopAtBreakBoundary();
|
|
6884
6897
|
}
|
|
6885
|
-
|
|
6886
|
-
currentVolume = this.video.volume;
|
|
6887
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
6888
|
-
this.ima.setAdVolume(adVolume);
|
|
6898
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
6889
6899
|
this.consecutiveFailures = 0;
|
|
6890
6900
|
return [
|
|
6891
6901
|
2
|
|
@@ -6932,9 +6942,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6932
6942
|
if (this.config.debugAdTiming) {
|
|
6933
6943
|
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via IMA SDK (".concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
|
|
6934
6944
|
}
|
|
6935
|
-
|
|
6936
|
-
currentVolume1 = this.video.volume;
|
|
6937
|
-
this.ima.updateOriginalMutedState(currentMuted1, currentVolume1);
|
|
6945
|
+
this.ima.updateOriginalMutedState((_ref = (_this_preAdBreakAudio = this.preAdBreakAudio) === null || _this_preAdBreakAudio === void 0 ? void 0 : _this_preAdBreakAudio.muted) !== null && _ref !== void 0 ? _ref : this.video.muted, (_ref1 = (_this_preAdBreakAudio1 = this.preAdBreakAudio) === null || _this_preAdBreakAudio1 === void 0 ? void 0 : _this_preAdBreakAudio1.volume) !== null && _ref1 !== void 0 ? _ref1 : this.video.volume);
|
|
6938
6946
|
this.currentAdIndex++;
|
|
6939
6947
|
this.totalAdRequestsInBreak++;
|
|
6940
6948
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7027,7 +7035,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7027
7035
|
key: "showPlaceholderAndWaitForAds",
|
|
7028
7036
|
value: function showPlaceholderAndWaitForAds() {
|
|
7029
7037
|
return _async_to_generator(function() {
|
|
7030
|
-
var remaining, waitTime, checkInterval, maxChecks, i,
|
|
7038
|
+
var remaining, waitTime, checkInterval, maxChecks, i, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error, errorMessage;
|
|
7031
7039
|
return _ts_generator(this, function(_state) {
|
|
7032
7040
|
switch(_state.label){
|
|
7033
7041
|
case 0:
|
|
@@ -7123,9 +7131,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7123
7131
|
}
|
|
7124
7132
|
this.isShowingPlaceholder = false;
|
|
7125
7133
|
this.ima.hidePlaceholder();
|
|
7126
|
-
|
|
7127
|
-
currentVolume = this.video.volume;
|
|
7128
|
-
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
7134
|
+
this.ima.updateOriginalMutedState((_ref = (_this_preAdBreakAudio = this.preAdBreakAudio) === null || _this_preAdBreakAudio === void 0 ? void 0 : _this_preAdBreakAudio.muted) !== null && _ref !== void 0 ? _ref : this.video.muted, (_ref1 = (_this_preAdBreakAudio1 = this.preAdBreakAudio) === null || _this_preAdBreakAudio1 === void 0 ? void 0 : _this_preAdBreakAudio1.volume) !== null && _ref1 !== void 0 ? _ref1 : this.video.volume);
|
|
7129
7135
|
this.currentAdIndex++;
|
|
7130
7136
|
this.totalAdRequestsInBreak++;
|
|
7131
7137
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7307,7 +7313,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7307
7313
|
first = tags[0];
|
|
7308
7314
|
rest = tags.slice(1);
|
|
7309
7315
|
this.adPodQueue = rest;
|
|
7310
|
-
this.
|
|
7316
|
+
this.capturePreAdBreakAudio();
|
|
7311
7317
|
this.showAds = true;
|
|
7312
7318
|
this.inAdBreak = true;
|
|
7313
7319
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -7334,12 +7340,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7334
7340
|
];
|
|
7335
7341
|
case 3:
|
|
7336
7342
|
error = _state.sent();
|
|
7337
|
-
this.adPodQueue = [];
|
|
7338
|
-
this.inAdBreak = false;
|
|
7339
|
-
this.showAds = false;
|
|
7340
7343
|
if (this.config.debugAdTiming) {
|
|
7341
7344
|
console.warn("[StormcloudVideoPlayer] VMAP ad request failed:", error);
|
|
7342
7345
|
}
|
|
7346
|
+
this.handleAdPodComplete();
|
|
7343
7347
|
return [
|
|
7344
7348
|
3,
|
|
7345
7349
|
4
|
|
@@ -7570,7 +7574,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7570
7574
|
key: "playSingleAd",
|
|
7571
7575
|
value: function playSingleAd(vastTagUrl) {
|
|
7572
7576
|
return _async_to_generator(function() {
|
|
7573
|
-
var requestToken,
|
|
7577
|
+
var requestToken, playError, preloadedFallback, fallbackError, error, errorMessage, preloadedFallback1, fallbackError1;
|
|
7574
7578
|
return _ts_generator(this, function(_state) {
|
|
7575
7579
|
switch(_state.label){
|
|
7576
7580
|
case 0:
|
|
@@ -7657,10 +7661,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7657
7661
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7658
7662
|
this.scheduleAdStopAtBreakBoundary();
|
|
7659
7663
|
}
|
|
7660
|
-
|
|
7661
|
-
currentVolume = this.video.volume;
|
|
7662
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
7663
|
-
this.ima.setAdVolume(adVolume);
|
|
7664
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7664
7665
|
this.consecutiveFailures = 0;
|
|
7665
7666
|
this.temporaryFailureUrls.delete(vastTagUrl);
|
|
7666
7667
|
return [
|
|
@@ -7707,10 +7708,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7707
7708
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7708
7709
|
this.scheduleAdStopAtBreakBoundary();
|
|
7709
7710
|
}
|
|
7710
|
-
|
|
7711
|
-
currentVolume1 = this.video.volume;
|
|
7712
|
-
adVolume1 = currentMuted1 ? 0 : currentVolume1;
|
|
7713
|
-
this.ima.setAdVolume(adVolume1);
|
|
7711
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7714
7712
|
return [
|
|
7715
7713
|
2
|
|
7716
7714
|
];
|
|
@@ -7784,10 +7782,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7784
7782
|
];
|
|
7785
7783
|
case 14:
|
|
7786
7784
|
_state.sent();
|
|
7787
|
-
|
|
7788
|
-
currentVolume2 = this.video.volume;
|
|
7789
|
-
adVolume2 = currentMuted2 ? 0 : currentVolume2;
|
|
7790
|
-
this.ima.setAdVolume(adVolume2);
|
|
7785
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7791
7786
|
return [
|
|
7792
7787
|
2
|
|
7793
7788
|
];
|
|
@@ -7827,6 +7822,33 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7827
7822
|
}).call(this);
|
|
7828
7823
|
}
|
|
7829
7824
|
},
|
|
7825
|
+
{
|
|
7826
|
+
key: "capturePreAdBreakAudio",
|
|
7827
|
+
value: function capturePreAdBreakAudio() {
|
|
7828
|
+
if (this.preAdBreakAudio) {
|
|
7829
|
+
return;
|
|
7830
|
+
}
|
|
7831
|
+
var captured = {
|
|
7832
|
+
muted: this.video.muted,
|
|
7833
|
+
volume: typeof this.video.volume === "number" && !Number.isNaN(this.video.volume) ? Math.max(0, Math.min(1, this.video.volume)) : 1
|
|
7834
|
+
};
|
|
7835
|
+
this.preAdBreakAudio = captured;
|
|
7836
|
+
this.ima.updateOriginalMutedState(captured.muted, captured.volume);
|
|
7837
|
+
if (this.config.debugAdTiming) {
|
|
7838
|
+
console.log("[StormcloudVideoPlayer] Captured pre-ad-break audio state: muted=".concat(captured.muted, ", volume=").concat(captured.volume));
|
|
7839
|
+
}
|
|
7840
|
+
}
|
|
7841
|
+
},
|
|
7842
|
+
{
|
|
7843
|
+
key: "getPreAdBreakAdVolume",
|
|
7844
|
+
value: function getPreAdBreakAdVolume() {
|
|
7845
|
+
var state = this.preAdBreakAudio;
|
|
7846
|
+
if (state) {
|
|
7847
|
+
return state.muted ? 0 : state.volume;
|
|
7848
|
+
}
|
|
7849
|
+
return this.ima.getOriginalMutedState() ? 0 : this.ima.getOriginalVolume();
|
|
7850
|
+
}
|
|
7851
|
+
},
|
|
7830
7852
|
{
|
|
7831
7853
|
key: "handleAdPodComplete",
|
|
7832
7854
|
value: function handleAdPodComplete() {
|
|
@@ -7860,14 +7882,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7860
7882
|
this.consecutiveFailures = 0;
|
|
7861
7883
|
this.globalConsecutiveNoFills = 0;
|
|
7862
7884
|
this.ima.stop().catch(function() {});
|
|
7863
|
-
var restoredMuted = this.ima.getOriginalMutedState();
|
|
7864
|
-
var restoredVolume = this.ima.getOriginalVolume();
|
|
7885
|
+
var restoredMuted = this.preAdBreakAudio ? this.preAdBreakAudio.muted : this.ima.getOriginalMutedState();
|
|
7886
|
+
var restoredVolume = this.preAdBreakAudio ? this.preAdBreakAudio.volume : this.ima.getOriginalVolume();
|
|
7887
|
+
this.ima.updateOriginalMutedState(restoredMuted, restoredVolume);
|
|
7865
7888
|
if (this.video.muted !== restoredMuted) {
|
|
7866
7889
|
this.video.muted = restoredMuted;
|
|
7867
7890
|
}
|
|
7868
7891
|
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
7869
7892
|
this.video.volume = restoredVolume;
|
|
7870
7893
|
}
|
|
7894
|
+
this.preAdBreakAudio = void 0;
|
|
7895
|
+
if (this.config.debugAdTiming) {
|
|
7896
|
+
console.log("[StormcloudVideoPlayer] Restored post-ad-break audio state: muted=".concat(restoredMuted, ", volume=").concat(restoredVolume));
|
|
7897
|
+
}
|
|
7871
7898
|
if (this.shouldContinueLiveStreamDuringAds()) {
|
|
7872
7899
|
if (this.video.paused) {
|
|
7873
7900
|
var _this_video_play;
|
|
@@ -8277,6 +8304,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8277
8304
|
this.clearAdFailsafeTimer();
|
|
8278
8305
|
this.clearAdRequestWatchdog();
|
|
8279
8306
|
this.clearPendingAdBreak();
|
|
8307
|
+
this.preAdBreakAudio = void 0;
|
|
8280
8308
|
if (this.placeholderContainer) {
|
|
8281
8309
|
if (this.placeholderContainer.parentElement) {
|
|
8282
8310
|
this.placeholderContainer.parentElement.removeChild(this.placeholderContainer);
|
|
@@ -8309,8 +8337,66 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8309
8337
|
return StormcloudVideoPlayer;
|
|
8310
8338
|
}();
|
|
8311
8339
|
// src/ui/StormcloudVideoPlayer.tsx
|
|
8312
|
-
import { FaPlay, FaPause, FaVolumeUp, FaVolumeMute, FaVolumeDown
|
|
8340
|
+
import { FaPlay, FaPause, FaVolumeUp, FaVolumeMute, FaVolumeDown } from "react-icons/fa";
|
|
8313
8341
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8342
|
+
var ExpandIcon = function ExpandIcon(param) {
|
|
8343
|
+
var _param_size = param.size, size = _param_size === void 0 ? 18 : _param_size;
|
|
8344
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
8345
|
+
width: size,
|
|
8346
|
+
height: size,
|
|
8347
|
+
viewBox: "0 0 24 24",
|
|
8348
|
+
fill: "none",
|
|
8349
|
+
stroke: "currentColor",
|
|
8350
|
+
strokeWidth: 2,
|
|
8351
|
+
strokeLinecap: "round",
|
|
8352
|
+
strokeLinejoin: "round",
|
|
8353
|
+
"aria-hidden": "true",
|
|
8354
|
+
focusable: "false",
|
|
8355
|
+
children: [
|
|
8356
|
+
/* @__PURE__ */ jsx("path", {
|
|
8357
|
+
d: "M9 4H4v5"
|
|
8358
|
+
}),
|
|
8359
|
+
/* @__PURE__ */ jsx("path", {
|
|
8360
|
+
d: "M20 9V4h-5"
|
|
8361
|
+
}),
|
|
8362
|
+
/* @__PURE__ */ jsx("path", {
|
|
8363
|
+
d: "M15 20h5v-5"
|
|
8364
|
+
}),
|
|
8365
|
+
/* @__PURE__ */ jsx("path", {
|
|
8366
|
+
d: "M4 15v5h5"
|
|
8367
|
+
})
|
|
8368
|
+
]
|
|
8369
|
+
});
|
|
8370
|
+
};
|
|
8371
|
+
var CompressIcon = function CompressIcon(param) {
|
|
8372
|
+
var _param_size = param.size, size = _param_size === void 0 ? 18 : _param_size;
|
|
8373
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
8374
|
+
width: size,
|
|
8375
|
+
height: size,
|
|
8376
|
+
viewBox: "0 0 24 24",
|
|
8377
|
+
fill: "none",
|
|
8378
|
+
stroke: "currentColor",
|
|
8379
|
+
strokeWidth: 2,
|
|
8380
|
+
strokeLinecap: "round",
|
|
8381
|
+
strokeLinejoin: "round",
|
|
8382
|
+
"aria-hidden": "true",
|
|
8383
|
+
focusable: "false",
|
|
8384
|
+
children: [
|
|
8385
|
+
/* @__PURE__ */ jsx("path", {
|
|
8386
|
+
d: "M4 9h5V4"
|
|
8387
|
+
}),
|
|
8388
|
+
/* @__PURE__ */ jsx("path", {
|
|
8389
|
+
d: "M15 4v5h5"
|
|
8390
|
+
}),
|
|
8391
|
+
/* @__PURE__ */ jsx("path", {
|
|
8392
|
+
d: "M20 15h-5v5"
|
|
8393
|
+
}),
|
|
8394
|
+
/* @__PURE__ */ jsx("path", {
|
|
8395
|
+
d: "M9 20v-5H4"
|
|
8396
|
+
})
|
|
8397
|
+
]
|
|
8398
|
+
});
|
|
8399
|
+
};
|
|
8314
8400
|
var CRITICAL_PROPS = [
|
|
8315
8401
|
"src",
|
|
8316
8402
|
"allowNativeHls",
|
|
@@ -9361,9 +9447,9 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
9361
9447
|
minHeight: "".concat(36 * responsiveScale, "px")
|
|
9362
9448
|
},
|
|
9363
9449
|
title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
9364
|
-
children: isFullscreen ? /* @__PURE__ */ jsx(
|
|
9450
|
+
children: isFullscreen ? /* @__PURE__ */ jsx(CompressIcon, {
|
|
9365
9451
|
size: Math.max(14, 18 * responsiveScale)
|
|
9366
|
-
}) : /* @__PURE__ */ jsx(
|
|
9452
|
+
}) : /* @__PURE__ */ jsx(ExpandIcon, {
|
|
9367
9453
|
size: Math.max(14, 18 * responsiveScale)
|
|
9368
9454
|
})
|
|
9369
9455
|
})
|
|
@@ -9561,9 +9647,9 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
9561
9647
|
background: "rgba(0, 0, 0, 0.6)"
|
|
9562
9648
|
},
|
|
9563
9649
|
title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
9564
|
-
children: isFullscreen ? /* @__PURE__ */ jsx(
|
|
9650
|
+
children: isFullscreen ? /* @__PURE__ */ jsx(CompressIcon, {
|
|
9565
9651
|
size: Math.max(14, 18 * responsiveScale)
|
|
9566
|
-
}) : /* @__PURE__ */ jsx(
|
|
9652
|
+
}) : /* @__PURE__ */ jsx(ExpandIcon, {
|
|
9567
9653
|
size: Math.max(14, 18 * responsiveScale)
|
|
9568
9654
|
})
|
|
9569
9655
|
})
|