stormcloud-video-player 0.3.14 → 0.3.17
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 -10
- package/lib/index.cjs +8282 -6531
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +8112 -6495
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +5575 -3981
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/FilePlayer.cjs +556 -225
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +5845 -4163
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +6142 -4371
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +954 -699
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/sdk/ima.cjs +1034 -809
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/sdk/ima.d.cts +1 -1
- package/lib/{types-t9jEJXZy.d.cts → types-CryTJVCC.d.cts} +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +6992 -5561
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/browserCompat.cjs +241 -194
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs +379 -214
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +559 -257
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/package.json +6 -1
- package/rollup.config.js +22 -0
package/lib/utils/tracking.cjs
CHANGED
|
@@ -1,284 +1,586 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
+
try {
|
|
4
|
+
var info = gen[key](arg);
|
|
5
|
+
var value = info.value;
|
|
6
|
+
} catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
} else {
|
|
13
|
+
Promise.resolve(value).then(_next, _throw);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _async_to_generator(fn) {
|
|
17
|
+
return function() {
|
|
18
|
+
var self = this, args = arguments;
|
|
19
|
+
return new Promise(function(resolve, reject) {
|
|
20
|
+
var gen = fn.apply(self, args);
|
|
21
|
+
function _next(value) {
|
|
22
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
+
}
|
|
24
|
+
function _throw(err) {
|
|
25
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
+
}
|
|
27
|
+
_next(undefined);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function _define_property(obj, key, value) {
|
|
32
|
+
if (key in obj) {
|
|
33
|
+
Object.defineProperty(obj, key, {
|
|
34
|
+
value: value,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
obj[key] = value;
|
|
41
|
+
}
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
44
|
+
function _object_spread(target) {
|
|
45
|
+
for(var i = 1; i < arguments.length; i++){
|
|
46
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
47
|
+
var ownKeys = Object.keys(source);
|
|
48
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
49
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
50
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
ownKeys.forEach(function(key) {
|
|
54
|
+
_define_property(target, key, source[key]);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return target;
|
|
58
|
+
}
|
|
59
|
+
function _type_of(obj) {
|
|
60
|
+
"@swc/helpers - typeof";
|
|
61
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
62
|
+
}
|
|
63
|
+
function _ts_generator(thisArg, body) {
|
|
64
|
+
var f, y, t, _ = {
|
|
65
|
+
label: 0,
|
|
66
|
+
sent: function() {
|
|
67
|
+
if (t[0] & 1) throw t[1];
|
|
68
|
+
return t[1];
|
|
69
|
+
},
|
|
70
|
+
trys: [],
|
|
71
|
+
ops: []
|
|
72
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
73
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
74
|
+
return this;
|
|
75
|
+
}), g;
|
|
76
|
+
function verb(n) {
|
|
77
|
+
return function(v) {
|
|
78
|
+
return step([
|
|
79
|
+
n,
|
|
80
|
+
v
|
|
81
|
+
]);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function step(op) {
|
|
85
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
86
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
87
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
88
|
+
if (y = 0, t) op = [
|
|
89
|
+
op[0] & 2,
|
|
90
|
+
t.value
|
|
91
|
+
];
|
|
92
|
+
switch(op[0]){
|
|
93
|
+
case 0:
|
|
94
|
+
case 1:
|
|
95
|
+
t = op;
|
|
96
|
+
break;
|
|
97
|
+
case 4:
|
|
98
|
+
_.label++;
|
|
99
|
+
return {
|
|
100
|
+
value: op[1],
|
|
101
|
+
done: false
|
|
102
|
+
};
|
|
103
|
+
case 5:
|
|
104
|
+
_.label++;
|
|
105
|
+
y = op[1];
|
|
106
|
+
op = [
|
|
107
|
+
0
|
|
108
|
+
];
|
|
109
|
+
continue;
|
|
110
|
+
case 7:
|
|
111
|
+
op = _.ops.pop();
|
|
112
|
+
_.trys.pop();
|
|
113
|
+
continue;
|
|
114
|
+
default:
|
|
115
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
116
|
+
_ = 0;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
120
|
+
_.label = op[1];
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
124
|
+
_.label = t[1];
|
|
125
|
+
t = op;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
if (t && _.label < t[2]) {
|
|
129
|
+
_.label = t[2];
|
|
130
|
+
_.ops.push(op);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
if (t[2]) _.ops.pop();
|
|
134
|
+
_.trys.pop();
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
op = body.call(thisArg, _);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
op = [
|
|
140
|
+
6,
|
|
141
|
+
e
|
|
142
|
+
];
|
|
143
|
+
y = 0;
|
|
144
|
+
} finally{
|
|
145
|
+
f = t = 0;
|
|
146
|
+
}
|
|
147
|
+
if (op[0] & 5) throw op[1];
|
|
148
|
+
return {
|
|
149
|
+
value: op[0] ? op[1] : void 0,
|
|
150
|
+
done: true
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
2
154
|
var __defProp = Object.defineProperty;
|
|
3
155
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
156
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
157
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all)
|
|
7
|
-
|
|
8
|
-
|
|
158
|
+
var __export = function(target, all) {
|
|
159
|
+
for(var name in all)__defProp(target, name, {
|
|
160
|
+
get: all[name],
|
|
161
|
+
enumerable: true
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
var __copyProps = function(to, from, except, desc) {
|
|
165
|
+
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
166
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
167
|
+
try {
|
|
168
|
+
var _loop = function() {
|
|
169
|
+
var key = _step.value;
|
|
170
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
171
|
+
get: function() {
|
|
172
|
+
return from[key];
|
|
173
|
+
},
|
|
174
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
178
|
+
} catch (err) {
|
|
179
|
+
_didIteratorError = true;
|
|
180
|
+
_iteratorError = err;
|
|
181
|
+
} finally{
|
|
182
|
+
try {
|
|
183
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
184
|
+
_iterator.return();
|
|
185
|
+
}
|
|
186
|
+
} finally{
|
|
187
|
+
if (_didIteratorError) {
|
|
188
|
+
throw _iteratorError;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return to;
|
|
9
194
|
};
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
195
|
+
var __toCommonJS = function(mod) {
|
|
196
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
197
|
+
value: true
|
|
198
|
+
}), mod);
|
|
17
199
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
200
|
// src/utils/tracking.ts
|
|
21
201
|
var tracking_exports = {};
|
|
22
202
|
__export(tracking_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
203
|
+
getBrowserID: function() {
|
|
204
|
+
return getBrowserID;
|
|
205
|
+
},
|
|
206
|
+
getClientInfo: function() {
|
|
207
|
+
return getClientInfo;
|
|
208
|
+
},
|
|
209
|
+
sendHeartbeat: function() {
|
|
210
|
+
return sendHeartbeat;
|
|
211
|
+
},
|
|
212
|
+
sendInitialTracking: function() {
|
|
213
|
+
return sendInitialTracking;
|
|
214
|
+
}
|
|
27
215
|
});
|
|
28
216
|
module.exports = __toCommonJS(tracking_exports);
|
|
29
217
|
var cachedBrowserId = null;
|
|
30
218
|
function getClientInfo() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
if (ua.includes("Android")) {
|
|
101
|
-
isAndroid = true;
|
|
102
|
-
os = "Android";
|
|
103
|
-
deviceType = /Mobile/.test(ua) ? "mobile" : "tablet";
|
|
104
|
-
if (ua.includes("Android") && (maxTouchPoints === 0 || ua.includes("Google TV") || ua.includes("XiaoMi"))) {
|
|
105
|
-
deviceType = "tv";
|
|
106
|
-
isSmartTV = true;
|
|
107
|
-
brand = brand === "Unknown" ? "Android TV" : brand;
|
|
108
|
-
}
|
|
109
|
-
const androidModelMatch = ua.match(/\(([^)]*Android[^)]*)\)/);
|
|
110
|
-
if (androidModelMatch && androidModelMatch[1]) {
|
|
111
|
-
model = androidModelMatch[1];
|
|
219
|
+
var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
|
|
220
|
+
var ua = navigator.userAgent;
|
|
221
|
+
var platform = navigator.platform;
|
|
222
|
+
var vendor = navigator.vendor || "";
|
|
223
|
+
var maxTouchPoints = navigator.maxTouchPoints || 0;
|
|
224
|
+
var memory = navigator.deviceMemory || null;
|
|
225
|
+
var hardwareConcurrency = navigator.hardwareConcurrency || 1;
|
|
226
|
+
var screenInfo = {
|
|
227
|
+
width: (_screen = screen) === null || _screen === void 0 ? void 0 : _screen.width,
|
|
228
|
+
height: (_screen1 = screen) === null || _screen1 === void 0 ? void 0 : _screen1.height,
|
|
229
|
+
availWidth: (_screen2 = screen) === null || _screen2 === void 0 ? void 0 : _screen2.availWidth,
|
|
230
|
+
availHeight: (_screen3 = screen) === null || _screen3 === void 0 ? void 0 : _screen3.availHeight,
|
|
231
|
+
orientation: ((_screen4 = screen) === null || _screen4 === void 0 ? void 0 : (_screen_orientation = _screen4.orientation) === null || _screen_orientation === void 0 ? void 0 : _screen_orientation.type) || "",
|
|
232
|
+
pixelDepth: (_screen5 = screen) === null || _screen5 === void 0 ? void 0 : _screen5.pixelDepth
|
|
233
|
+
};
|
|
234
|
+
var deviceType = "desktop";
|
|
235
|
+
var brand = "Unknown";
|
|
236
|
+
var os = "Unknown";
|
|
237
|
+
var model = "";
|
|
238
|
+
var isSmartTV = false;
|
|
239
|
+
var isAndroid = false;
|
|
240
|
+
var isWebView = false;
|
|
241
|
+
var isWebApp = false;
|
|
242
|
+
if (ua.includes("Web0S")) {
|
|
243
|
+
brand = "LG";
|
|
244
|
+
os = "webOS";
|
|
245
|
+
isSmartTV = true;
|
|
246
|
+
deviceType = "tv";
|
|
247
|
+
var webosMatch = ua.match(/Web0S\/([^\s]+)/);
|
|
248
|
+
model = webosMatch ? "webOS ".concat(webosMatch[1]) : "webOS TV";
|
|
249
|
+
} else if (ua.includes("Tizen")) {
|
|
250
|
+
brand = "Samsung";
|
|
251
|
+
os = "Tizen";
|
|
252
|
+
isSmartTV = true;
|
|
253
|
+
deviceType = "tv";
|
|
254
|
+
var tizenMatch = ua.match(/Tizen\/([^\s]+)/);
|
|
255
|
+
var tvMatch = ua.match(/(?:Smart-TV|SMART-TV|TV)/i) ? "Smart TV" : "";
|
|
256
|
+
model = tizenMatch ? "Tizen ".concat(tizenMatch[1], " ").concat(tvMatch).trim() : "Tizen TV";
|
|
257
|
+
} else if (ua.includes("Philips")) {
|
|
258
|
+
brand = "Philips";
|
|
259
|
+
os = "Saphi";
|
|
260
|
+
isSmartTV = true;
|
|
261
|
+
deviceType = "tv";
|
|
262
|
+
} else if (ua.includes("Sharp") || ua.includes("AQUOS")) {
|
|
263
|
+
brand = "Sharp";
|
|
264
|
+
os = "Android TV";
|
|
265
|
+
isSmartTV = true;
|
|
266
|
+
deviceType = "tv";
|
|
267
|
+
} else if (ua.includes("Android") && (ua.includes("Sony") || vendor.includes("Sony"))) {
|
|
268
|
+
brand = "Sony";
|
|
269
|
+
os = "Android TV";
|
|
270
|
+
isSmartTV = true;
|
|
271
|
+
deviceType = "tv";
|
|
272
|
+
} else if (ua.includes("Android") && (ua.includes("NetCast") || ua.includes("LG"))) {
|
|
273
|
+
brand = "LG";
|
|
274
|
+
os = "Android TV";
|
|
275
|
+
isSmartTV = true;
|
|
276
|
+
deviceType = "tv";
|
|
277
|
+
} else if (ua.includes(" Roku") || ua.includes("Roku/")) {
|
|
278
|
+
brand = "Roku";
|
|
279
|
+
os = "Roku OS";
|
|
280
|
+
isSmartTV = true;
|
|
281
|
+
deviceType = "tv";
|
|
282
|
+
} else if (ua.includes("AppleTV")) {
|
|
283
|
+
brand = "Apple";
|
|
284
|
+
os = "tvOS";
|
|
285
|
+
isSmartTV = true;
|
|
286
|
+
deviceType = "tv";
|
|
112
287
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
288
|
+
if (ua.includes("Android")) {
|
|
289
|
+
isAndroid = true;
|
|
290
|
+
os = "Android";
|
|
291
|
+
deviceType = /Mobile/.test(ua) ? "mobile" : "tablet";
|
|
292
|
+
if (ua.includes("Android") && (maxTouchPoints === 0 || ua.includes("Google TV") || ua.includes("XiaoMi"))) {
|
|
293
|
+
deviceType = "tv";
|
|
294
|
+
isSmartTV = true;
|
|
295
|
+
brand = brand === "Unknown" ? "Android TV" : brand;
|
|
296
|
+
}
|
|
297
|
+
var androidModelMatch = ua.match(/\(([^)]*Android[^)]*)\)/);
|
|
298
|
+
if (androidModelMatch && androidModelMatch[1]) {
|
|
299
|
+
model = androidModelMatch[1];
|
|
300
|
+
}
|
|
120
301
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
deviceType = "desktop";
|
|
129
|
-
if (maxTouchPoints > 1) deviceType = "tablet";
|
|
130
|
-
} else if (ua.includes("Linux")) {
|
|
131
|
-
os = "Linux";
|
|
132
|
-
deviceType = "desktop";
|
|
302
|
+
if (/iPad|iPhone|iPod/.test(ua)) {
|
|
303
|
+
os = "iOS";
|
|
304
|
+
deviceType = "mobile";
|
|
305
|
+
brand = "Apple";
|
|
306
|
+
if (navigator.maxTouchPoints > 1 && /iPad/.test(ua)) {
|
|
307
|
+
deviceType = "tablet";
|
|
308
|
+
}
|
|
133
309
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
brand,
|
|
147
|
-
os,
|
|
148
|
-
model: model || ua.substring(0, 50) + "...",
|
|
149
|
-
deviceType,
|
|
150
|
-
isSmartTV,
|
|
151
|
-
isAndroid,
|
|
152
|
-
isWebView,
|
|
153
|
-
isWebApp,
|
|
154
|
-
domain: window.location.hostname,
|
|
155
|
-
origin: window.location.origin,
|
|
156
|
-
path: window.location.pathname,
|
|
157
|
-
userAgent: ua,
|
|
158
|
-
vendor,
|
|
159
|
-
platform,
|
|
160
|
-
screen: screenInfo,
|
|
161
|
-
hardwareConcurrency,
|
|
162
|
-
deviceMemory: memory,
|
|
163
|
-
maxTouchPoints,
|
|
164
|
-
language: navigator.language,
|
|
165
|
-
languages: ((_d = navigator.languages) == null ? void 0 : _d.join(",")) || "",
|
|
166
|
-
cookieEnabled: navigator.cookieEnabled,
|
|
167
|
-
doNotTrack: navigator.doNotTrack || "",
|
|
168
|
-
referrer: document.referrer,
|
|
169
|
-
visibilityState: document.visibilityState
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
async function getBrowserID(clientInfo) {
|
|
173
|
-
if (cachedBrowserId) {
|
|
174
|
-
return cachedBrowserId;
|
|
175
|
-
}
|
|
176
|
-
const fingerprintString = JSON.stringify(clientInfo);
|
|
177
|
-
if (typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest) {
|
|
178
|
-
try {
|
|
179
|
-
await crypto.subtle.digest("SHA-256", new Uint8Array([1, 2, 3]));
|
|
180
|
-
let encodedData;
|
|
181
|
-
if (typeof TextEncoder !== "undefined") {
|
|
182
|
-
encodedData = new TextEncoder().encode(fingerprintString);
|
|
183
|
-
} else {
|
|
184
|
-
const utf8 = unescape(encodeURIComponent(fingerprintString));
|
|
185
|
-
const buffer = new Uint8Array(utf8.length);
|
|
186
|
-
for (let i = 0; i < utf8.length; i++) {
|
|
187
|
-
buffer[i] = utf8.charCodeAt(i);
|
|
310
|
+
if (!isAndroid && !isSmartTV && !/Mobile/.test(ua)) {
|
|
311
|
+
if (ua.includes("Windows")) {
|
|
312
|
+
os = "Windows";
|
|
313
|
+
deviceType = "desktop";
|
|
314
|
+
} else if (ua.includes("Mac") && !/iPhone/.test(ua)) {
|
|
315
|
+
os = "macOS";
|
|
316
|
+
deviceType = "desktop";
|
|
317
|
+
if (maxTouchPoints > 1) deviceType = "tablet";
|
|
318
|
+
} else if (ua.includes("Linux")) {
|
|
319
|
+
os = "Linux";
|
|
320
|
+
deviceType = "desktop";
|
|
188
321
|
}
|
|
189
|
-
encodedData = buffer;
|
|
190
|
-
}
|
|
191
|
-
const hashBuffer = await crypto.subtle.digest("SHA-256", encodedData);
|
|
192
|
-
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
193
|
-
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
194
|
-
cachedBrowserId = hashHex;
|
|
195
|
-
return hashHex;
|
|
196
|
-
} catch (error) {
|
|
197
|
-
console.warn(
|
|
198
|
-
"[StormcloudVideoPlayer] crypto.subtle.digest not supported, using fallback hash"
|
|
199
|
-
);
|
|
200
322
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
hash = (hash << 5) - hash + char;
|
|
206
|
-
hash = hash & hash;
|
|
207
|
-
}
|
|
208
|
-
const fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
209
|
-
const timestamp = Date.now().toString(16).padStart(12, "0");
|
|
210
|
-
const random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
211
|
-
cachedBrowserId = (fallbackHash + timestamp + random).padEnd(64, "0");
|
|
212
|
-
return cachedBrowserId;
|
|
213
|
-
}
|
|
214
|
-
async function sendInitialTracking(licenseKey) {
|
|
215
|
-
try {
|
|
216
|
-
const clientInfo = getClientInfo();
|
|
217
|
-
const browserId = await getBrowserID(clientInfo);
|
|
218
|
-
const trackingData = {
|
|
219
|
-
browserId,
|
|
220
|
-
...clientInfo
|
|
221
|
-
};
|
|
222
|
-
const headers = {
|
|
223
|
-
"Content-Type": "application/json"
|
|
224
|
-
};
|
|
225
|
-
if (licenseKey) {
|
|
226
|
-
headers["Authorization"] = `Bearer ${licenseKey}`;
|
|
323
|
+
if (brand === "Unknown") {
|
|
324
|
+
if (vendor.includes("Google") || ua.includes("Chrome")) brand = "Google";
|
|
325
|
+
if (vendor.includes("Apple")) brand = "Apple";
|
|
326
|
+
if (vendor.includes("Samsung") || ua.includes("SM-")) brand = "Samsung";
|
|
227
327
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
method: "POST",
|
|
232
|
-
headers,
|
|
233
|
-
body: JSON.stringify(trackingData)
|
|
234
|
-
}
|
|
235
|
-
);
|
|
236
|
-
if (!response.ok) {
|
|
237
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
328
|
+
isWebView = /wv|WebView|Linux; U;/.test(ua);
|
|
329
|
+
if (((_window = window) === null || _window === void 0 ? void 0 : _window.outerHeight) === 0 && ((_window1 = window) === null || _window1 === void 0 ? void 0 : _window1.outerWidth) === 0) {
|
|
330
|
+
isWebView = true;
|
|
238
331
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
332
|
+
isWebApp = window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === true || ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : (_window_screen_orientation = _window_screen.orientation) === null || _window_screen_orientation === void 0 ? void 0 : _window_screen_orientation.angle) !== void 0;
|
|
333
|
+
return {
|
|
334
|
+
brand: brand,
|
|
335
|
+
os: os,
|
|
336
|
+
model: model || ua.substring(0, 50) + "...",
|
|
337
|
+
deviceType: deviceType,
|
|
338
|
+
isSmartTV: isSmartTV,
|
|
339
|
+
isAndroid: isAndroid,
|
|
340
|
+
isWebView: isWebView,
|
|
341
|
+
isWebApp: isWebApp,
|
|
342
|
+
domain: window.location.hostname,
|
|
343
|
+
origin: window.location.origin,
|
|
344
|
+
path: window.location.pathname,
|
|
345
|
+
userAgent: ua,
|
|
346
|
+
vendor: vendor,
|
|
347
|
+
platform: platform,
|
|
348
|
+
screen: screenInfo,
|
|
349
|
+
hardwareConcurrency: hardwareConcurrency,
|
|
350
|
+
deviceMemory: memory,
|
|
351
|
+
maxTouchPoints: maxTouchPoints,
|
|
352
|
+
language: navigator.language,
|
|
353
|
+
languages: ((_navigator_languages = navigator.languages) === null || _navigator_languages === void 0 ? void 0 : _navigator_languages.join(",")) || "",
|
|
354
|
+
cookieEnabled: navigator.cookieEnabled,
|
|
355
|
+
doNotTrack: navigator.doNotTrack || "",
|
|
356
|
+
referrer: document.referrer,
|
|
357
|
+
visibilityState: document.visibilityState
|
|
254
358
|
};
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
359
|
+
}
|
|
360
|
+
function getBrowserID(clientInfo) {
|
|
361
|
+
return _async_to_generator(function() {
|
|
362
|
+
var fingerprintString, encodedData, utf8, buffer, i, hashBuffer, hashArray, hashHex, error, hash, i1, char, fallbackHash, timestamp, random;
|
|
363
|
+
return _ts_generator(this, function(_state) {
|
|
364
|
+
switch(_state.label){
|
|
365
|
+
case 0:
|
|
366
|
+
if (cachedBrowserId) {
|
|
367
|
+
return [
|
|
368
|
+
2,
|
|
369
|
+
cachedBrowserId
|
|
370
|
+
];
|
|
371
|
+
}
|
|
372
|
+
fingerprintString = JSON.stringify(clientInfo);
|
|
373
|
+
if (!(typeof crypto !== "undefined" && crypto.subtle && crypto.subtle.digest)) return [
|
|
374
|
+
3,
|
|
375
|
+
5
|
|
376
|
+
];
|
|
377
|
+
_state.label = 1;
|
|
378
|
+
case 1:
|
|
379
|
+
_state.trys.push([
|
|
380
|
+
1,
|
|
381
|
+
4,
|
|
382
|
+
,
|
|
383
|
+
5
|
|
384
|
+
]);
|
|
385
|
+
return [
|
|
386
|
+
4,
|
|
387
|
+
crypto.subtle.digest("SHA-256", new Uint8Array([
|
|
388
|
+
1,
|
|
389
|
+
2,
|
|
390
|
+
3
|
|
391
|
+
]))
|
|
392
|
+
];
|
|
393
|
+
case 2:
|
|
394
|
+
_state.sent();
|
|
395
|
+
if (typeof TextEncoder !== "undefined") {
|
|
396
|
+
encodedData = new TextEncoder().encode(fingerprintString);
|
|
397
|
+
} else {
|
|
398
|
+
utf8 = unescape(encodeURIComponent(fingerprintString));
|
|
399
|
+
buffer = new Uint8Array(utf8.length);
|
|
400
|
+
for(i = 0; i < utf8.length; i++){
|
|
401
|
+
buffer[i] = utf8.charCodeAt(i);
|
|
402
|
+
}
|
|
403
|
+
encodedData = buffer;
|
|
404
|
+
}
|
|
405
|
+
return [
|
|
406
|
+
4,
|
|
407
|
+
crypto.subtle.digest("SHA-256", encodedData)
|
|
408
|
+
];
|
|
409
|
+
case 3:
|
|
410
|
+
hashBuffer = _state.sent();
|
|
411
|
+
hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
412
|
+
hashHex = hashArray.map(function(b) {
|
|
413
|
+
return b.toString(16).padStart(2, "0");
|
|
414
|
+
}).join("");
|
|
415
|
+
cachedBrowserId = hashHex;
|
|
416
|
+
return [
|
|
417
|
+
2,
|
|
418
|
+
hashHex
|
|
419
|
+
];
|
|
420
|
+
case 4:
|
|
421
|
+
error = _state.sent();
|
|
422
|
+
console.warn("[StormcloudVideoPlayer] crypto.subtle.digest not supported, using fallback hash");
|
|
423
|
+
return [
|
|
424
|
+
3,
|
|
425
|
+
5
|
|
426
|
+
];
|
|
427
|
+
case 5:
|
|
428
|
+
hash = 0;
|
|
429
|
+
for(i1 = 0; i1 < fingerprintString.length; i1++){
|
|
430
|
+
char = fingerprintString.charCodeAt(i1);
|
|
431
|
+
hash = (hash << 5) - hash + char;
|
|
432
|
+
hash = hash & hash;
|
|
433
|
+
}
|
|
434
|
+
fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
435
|
+
timestamp = Date.now().toString(16).padStart(12, "0");
|
|
436
|
+
random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
437
|
+
cachedBrowserId = (fallbackHash + timestamp + random).padEnd(64, "0");
|
|
438
|
+
return [
|
|
439
|
+
2,
|
|
440
|
+
cachedBrowserId
|
|
441
|
+
];
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
})();
|
|
445
|
+
}
|
|
446
|
+
function sendInitialTracking(licenseKey) {
|
|
447
|
+
return _async_to_generator(function() {
|
|
448
|
+
var clientInfo, browserId, trackingData, headers, response, error;
|
|
449
|
+
return _ts_generator(this, function(_state) {
|
|
450
|
+
switch(_state.label){
|
|
451
|
+
case 0:
|
|
452
|
+
_state.trys.push([
|
|
453
|
+
0,
|
|
454
|
+
4,
|
|
455
|
+
,
|
|
456
|
+
5
|
|
457
|
+
]);
|
|
458
|
+
clientInfo = getClientInfo();
|
|
459
|
+
return [
|
|
460
|
+
4,
|
|
461
|
+
getBrowserID(clientInfo)
|
|
462
|
+
];
|
|
463
|
+
case 1:
|
|
464
|
+
browserId = _state.sent();
|
|
465
|
+
trackingData = _object_spread({
|
|
466
|
+
browserId: browserId
|
|
467
|
+
}, clientInfo);
|
|
468
|
+
headers = {
|
|
469
|
+
"Content-Type": "application/json"
|
|
470
|
+
};
|
|
471
|
+
if (licenseKey) {
|
|
472
|
+
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
473
|
+
}
|
|
474
|
+
return [
|
|
475
|
+
4,
|
|
476
|
+
fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/track", {
|
|
477
|
+
method: "POST",
|
|
478
|
+
headers: headers,
|
|
479
|
+
body: JSON.stringify(trackingData)
|
|
480
|
+
})
|
|
481
|
+
];
|
|
482
|
+
case 2:
|
|
483
|
+
response = _state.sent();
|
|
484
|
+
if (!response.ok) {
|
|
485
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
486
|
+
}
|
|
487
|
+
return [
|
|
488
|
+
4,
|
|
489
|
+
response.json()
|
|
490
|
+
];
|
|
491
|
+
case 3:
|
|
492
|
+
_state.sent();
|
|
493
|
+
return [
|
|
494
|
+
3,
|
|
495
|
+
5
|
|
496
|
+
];
|
|
497
|
+
case 4:
|
|
498
|
+
error = _state.sent();
|
|
499
|
+
console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
|
|
500
|
+
return [
|
|
501
|
+
3,
|
|
502
|
+
5
|
|
503
|
+
];
|
|
504
|
+
case 5:
|
|
505
|
+
return [
|
|
506
|
+
2
|
|
507
|
+
];
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
})();
|
|
511
|
+
}
|
|
512
|
+
function sendHeartbeat(licenseKey) {
|
|
513
|
+
return _async_to_generator(function() {
|
|
514
|
+
var clientInfo, browserId, heartbeatData, headers, response, error;
|
|
515
|
+
return _ts_generator(this, function(_state) {
|
|
516
|
+
switch(_state.label){
|
|
517
|
+
case 0:
|
|
518
|
+
_state.trys.push([
|
|
519
|
+
0,
|
|
520
|
+
4,
|
|
521
|
+
,
|
|
522
|
+
5
|
|
523
|
+
]);
|
|
524
|
+
clientInfo = getClientInfo();
|
|
525
|
+
return [
|
|
526
|
+
4,
|
|
527
|
+
getBrowserID(clientInfo)
|
|
528
|
+
];
|
|
529
|
+
case 1:
|
|
530
|
+
browserId = _state.sent();
|
|
531
|
+
heartbeatData = {
|
|
532
|
+
browserId: browserId,
|
|
533
|
+
timestamp: /* @__PURE__ */ new Date().toISOString()
|
|
534
|
+
};
|
|
535
|
+
headers = {
|
|
536
|
+
"Content-Type": "application/json"
|
|
537
|
+
};
|
|
538
|
+
if (licenseKey) {
|
|
539
|
+
headers["Authorization"] = "Bearer ".concat(licenseKey);
|
|
540
|
+
}
|
|
541
|
+
return [
|
|
542
|
+
4,
|
|
543
|
+
fetch("https://adstorm.co/api-adstorm-dev/adstorm/player-tracking/heartbeat", {
|
|
544
|
+
method: "POST",
|
|
545
|
+
headers: headers,
|
|
546
|
+
body: JSON.stringify(heartbeatData)
|
|
547
|
+
})
|
|
548
|
+
];
|
|
549
|
+
case 2:
|
|
550
|
+
response = _state.sent();
|
|
551
|
+
if (!response.ok) {
|
|
552
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
553
|
+
}
|
|
554
|
+
return [
|
|
555
|
+
4,
|
|
556
|
+
response.json()
|
|
557
|
+
];
|
|
558
|
+
case 3:
|
|
559
|
+
_state.sent();
|
|
560
|
+
return [
|
|
561
|
+
3,
|
|
562
|
+
5
|
|
563
|
+
];
|
|
564
|
+
case 4:
|
|
565
|
+
error = _state.sent();
|
|
566
|
+
console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
|
|
567
|
+
return [
|
|
568
|
+
3,
|
|
569
|
+
5
|
|
570
|
+
];
|
|
571
|
+
case 5:
|
|
572
|
+
return [
|
|
573
|
+
2
|
|
574
|
+
];
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
})();
|
|
276
578
|
}
|
|
277
579
|
// Annotate the CommonJS export names for ESM import in node:
|
|
278
580
|
0 && (module.exports = {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
581
|
+
getBrowserID: getBrowserID,
|
|
582
|
+
getClientInfo: getClientInfo,
|
|
583
|
+
sendHeartbeat: sendHeartbeat,
|
|
584
|
+
sendInitialTracking: sendInitialTracking
|
|
283
585
|
});
|
|
284
586
|
//# sourceMappingURL=tracking.cjs.map
|