@latest-thinking/lt-player 1.0.4-o → 1.0.4-q
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/js/lt-player-main.js +1 -1
- package/dist/js/lt-player-main.js.map +1 -1
- package/package.json +1 -1
- package/src/components/LTPlayerSetup.ts +26 -2
- package/src/components/LTPlayerType.ts +11 -7
- package/src/components/config/LTPlayerConfig.ts +192 -0
- package/src/components/config/LTPlayerConfigProcessor.ts +546 -0
- package/src/components/controls/LTPlayerControls.ts +1 -1
- package/src/components/poster/LTPlayerPoster.ts +1 -1
- package/src/components/poster/LTPlayerPosterManager.ts +1 -1
- package/src/components/poster/LTPlayerPosterPreload.ts +1 -1
- package/src/components/share/LTPlayerShare.ts +1 -1
- package/src/global/controllers/LTPlayerController.ts +1 -1
- package/src/services/Helper.ts +20 -5
- package/src/services/ResizeService.ts +19 -2
- package/src/services/TemplateService.ts +1 -1
- package/src/views/template.handlebars +2 -2
- package/src/components/LTPlayerConfig.ts +0 -398
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import {defaultType, urlDataType} from "../../global/types/ModuleTypes";
|
|
2
|
+
import {Helper} from "../../services/Helper";
|
|
3
|
+
|
|
4
|
+
export namespace LTPlayerConfigProcessor {
|
|
5
|
+
export class Map {
|
|
6
|
+
version : number
|
|
7
|
+
|
|
8
|
+
setVersion(version : number) {
|
|
9
|
+
this.version = version;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
processItem(name: string, value : any) {
|
|
13
|
+
return this.mapByVersion(name, value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
mapByVersion(name: string, value : any) {
|
|
17
|
+
switch (name) {
|
|
18
|
+
case 'preload':
|
|
19
|
+
return Processor.processPreload(value, this.version);
|
|
20
|
+
case 'autoPlay' :
|
|
21
|
+
return Processor.processAutoPlay(value, this.version);
|
|
22
|
+
case 'videoTitle' :
|
|
23
|
+
return Processor.processVideoTitle(value, this.version);
|
|
24
|
+
case 'posterImage' :
|
|
25
|
+
return Processor.processPosterImage(value, this.version);
|
|
26
|
+
case 'videoParagraph':
|
|
27
|
+
return Processor.processVideoParagraph(value, this.version);
|
|
28
|
+
case 'videoUrl' :
|
|
29
|
+
return Processor.processVideoUrl(value, this.version);
|
|
30
|
+
case 'playerContainer' :
|
|
31
|
+
return Processor.processPlayerContainer(value, this.version);
|
|
32
|
+
case 'share':
|
|
33
|
+
return Processor.processShareData(value, this.version);
|
|
34
|
+
case 'vimeo':
|
|
35
|
+
return Processor.processVimeoConfig(value, this.version);
|
|
36
|
+
case 'defaultConfig':
|
|
37
|
+
return Processor.processDefaultConfig(value, this.version);
|
|
38
|
+
case 'chapters':
|
|
39
|
+
return Processor.processChapters(value, this.version);
|
|
40
|
+
case 'device':
|
|
41
|
+
if (this.version === 1) {
|
|
42
|
+
return value.device;
|
|
43
|
+
} else {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
case 'playerType':
|
|
47
|
+
if (this.version === 1) {
|
|
48
|
+
return value.playerType;
|
|
49
|
+
} else {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
case 'observe':
|
|
53
|
+
return Processor.processObserve(value, this.version);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export class Processor {
|
|
59
|
+
|
|
60
|
+
static processObserve(data : defaultType, version : number) {
|
|
61
|
+
|
|
62
|
+
let output : defaultType = {
|
|
63
|
+
width : false,
|
|
64
|
+
height : false
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if(!data) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (version === 1) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (Object.keys(data).length === 0) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const setPropriety = (value : boolean | string | number) : boolean => {
|
|
79
|
+
if (!value) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (typeof value === 'boolean') {
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (typeof value === 'string') {
|
|
88
|
+
return value === 'true' || value === 'TRUE' || value === '1';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (typeof value === 'number') {
|
|
92
|
+
return value === 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return false;
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
Object.keys(data).forEach(item => {
|
|
100
|
+
if (output.hasOwnProperty(item)) {
|
|
101
|
+
output[item] = setPropriety(data[item]);
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
return output
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static processChapters(data : defaultType, version : number) {
|
|
109
|
+
|
|
110
|
+
if(!data) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (version === 1) {
|
|
115
|
+
data = data.chapters;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (Object.keys(data).length === 0) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return data;
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
static processDefaultConfig(data : defaultType, version : number) {
|
|
128
|
+
let outputData : defaultType = {
|
|
129
|
+
speed : {
|
|
130
|
+
selected : 1,
|
|
131
|
+
captions : false,
|
|
132
|
+
update: true
|
|
133
|
+
},
|
|
134
|
+
captions : {
|
|
135
|
+
active : false
|
|
136
|
+
},
|
|
137
|
+
clickToPlay : false,
|
|
138
|
+
playsinline : true,
|
|
139
|
+
pip : false
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!data) {
|
|
143
|
+
return outputData;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (version === 1) {
|
|
147
|
+
return outputData;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (Object.keys(data).length === 0) {
|
|
151
|
+
return outputData;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Object.keys(data).forEach(item => {
|
|
155
|
+
if (outputData[item] !== undefined) {
|
|
156
|
+
outputData[item] = data[item];
|
|
157
|
+
} else {
|
|
158
|
+
outputData[item] = data[item];
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
return outputData;
|
|
163
|
+
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
static processVimeoConfig(data : defaultType, version : number) {
|
|
167
|
+
|
|
168
|
+
let outputData : defaultType = {
|
|
169
|
+
controls: false,
|
|
170
|
+
active: false,
|
|
171
|
+
gesture: 'media',
|
|
172
|
+
transparent: false,
|
|
173
|
+
speed: true,
|
|
174
|
+
portrait: true,
|
|
175
|
+
keyboard: false,
|
|
176
|
+
title: false,
|
|
177
|
+
byline: false,
|
|
178
|
+
playsinline: true,
|
|
179
|
+
background: true
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (version === 1) {
|
|
183
|
+
return outputData
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!data) {
|
|
187
|
+
return outputData;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (Object.keys(data).length === 0){
|
|
191
|
+
return outputData;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Object.keys(data).forEach(item => {
|
|
195
|
+
if (outputData[item] !== undefined) {
|
|
196
|
+
outputData[item] = data[item];
|
|
197
|
+
} else {
|
|
198
|
+
outputData[item] = data[item];
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
return outputData;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
static processShareData(data : defaultType, version : number) {
|
|
206
|
+
if (!data) {
|
|
207
|
+
return null
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (version === 1) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
type shareDataConfig = {
|
|
215
|
+
canonicalUrl : string,
|
|
216
|
+
embedUrl : string,
|
|
217
|
+
title : string
|
|
218
|
+
} | null
|
|
219
|
+
|
|
220
|
+
let outputData : shareDataConfig = {
|
|
221
|
+
canonicalUrl : undefined,
|
|
222
|
+
embedUrl : undefined,
|
|
223
|
+
title : undefined
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (Object.keys(data).length === 0) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (data.canonicalUrl !== undefined) {
|
|
231
|
+
outputData.canonicalUrl = data.canonicalUrl;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (data.embedUrl !== undefined) {
|
|
235
|
+
outputData.embedUrl = data.embedUrl;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (data.title !== undefined) {
|
|
239
|
+
outputData.title = data.title;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return outputData;
|
|
243
|
+
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
static processPlayerContainer(data : Element | defaultType, version : number) {
|
|
247
|
+
if (!data) {
|
|
248
|
+
return null
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (version === 1) {
|
|
252
|
+
return (data as defaultType).playerContainer;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return data;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static processVideoUrl(data : string | defaultType, version : number) {
|
|
259
|
+
|
|
260
|
+
if (!data) {
|
|
261
|
+
return null
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
if (version === 1) {
|
|
266
|
+
if (typeof data === 'object') {
|
|
267
|
+
data = data.sources.video_id;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
type configData = {videoUrl : string, videoType : string, embedId : string, embedHash : string, origin : string};
|
|
272
|
+
|
|
273
|
+
let outputData : configData = {
|
|
274
|
+
videoUrl : undefined,
|
|
275
|
+
videoType : undefined,
|
|
276
|
+
embedHash : undefined,
|
|
277
|
+
embedId : undefined,
|
|
278
|
+
origin : undefined
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (!Helper.isValidHttpUrl(data)) {
|
|
282
|
+
console.error(`Please insert valid url video url videoURL : ${data}`);
|
|
283
|
+
return outputData
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const urlVideoData: urlDataType = Helper.processConfigData(data);
|
|
287
|
+
|
|
288
|
+
const mapVideoData = (data: string | defaultType, urlVideoData: urlDataType, outputData: configData) => {
|
|
289
|
+
|
|
290
|
+
if (typeof data === "string") {
|
|
291
|
+
outputData.videoUrl = data;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (urlVideoData.origin) {
|
|
295
|
+
outputData.origin = urlVideoData.origin;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (urlVideoData.type) {
|
|
299
|
+
outputData.videoType = urlVideoData.type.toLowerCase()
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (urlVideoData.type === 'embedded') {
|
|
303
|
+
const embedID = Helper.getEmbeddedID(data);
|
|
304
|
+
|
|
305
|
+
if (embedID) {
|
|
306
|
+
outputData.embedId = embedID;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const embedHash = Helper.getEmbeddedHash(data);
|
|
310
|
+
|
|
311
|
+
if (embedHash) {
|
|
312
|
+
outputData.embedHash = embedHash;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return outputData;
|
|
317
|
+
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
outputData = mapVideoData(data, urlVideoData, outputData);
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
return outputData;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
static processVideoParagraph(data : string | defaultType, version : number) {
|
|
328
|
+
|
|
329
|
+
if (!data) {
|
|
330
|
+
return null
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
let outputData = undefined;
|
|
334
|
+
|
|
335
|
+
if (version === 1) {
|
|
336
|
+
if (typeof data === 'object') {
|
|
337
|
+
data = data.author;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (typeof data === 'string' && /[a-zA-Z]/.test(data)){
|
|
342
|
+
outputData = data;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return outputData;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
static processPosterImage(data: string | defaultType, version : number) {
|
|
349
|
+
|
|
350
|
+
if (!data) {
|
|
351
|
+
return null
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (version === 1) {
|
|
355
|
+
if (typeof data === 'object') {
|
|
356
|
+
return data.poster;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
let check = Helper.isValidHttpUrl(data);
|
|
361
|
+
|
|
362
|
+
if (check) {
|
|
363
|
+
return data;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
console.error(`Set valid url for poster image config item => posterImage : ${data} `);
|
|
367
|
+
return undefined;
|
|
368
|
+
}
|
|
369
|
+
static processVideoTitle(data : string | defaultType, version : number) {
|
|
370
|
+
|
|
371
|
+
if (!data) {
|
|
372
|
+
return null
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
let outputData = undefined;
|
|
376
|
+
|
|
377
|
+
if (version === 1) {
|
|
378
|
+
if (typeof data === 'object') {
|
|
379
|
+
data = data.title;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (data) {
|
|
384
|
+
if (typeof data === 'string' && /[a-zA-Z]/.test(data)){
|
|
385
|
+
outputData = data;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return outputData;
|
|
390
|
+
}
|
|
391
|
+
static processAutoPlay(data : boolean | string | object, version : number) {
|
|
392
|
+
|
|
393
|
+
if (!data) {
|
|
394
|
+
return null
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
let outputData : boolean = false;
|
|
398
|
+
|
|
399
|
+
if (version === 1) {
|
|
400
|
+
return outputData;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
if (typeof data === 'string') {
|
|
405
|
+
if (data === 'true') {
|
|
406
|
+
outputData = true;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (typeof data === 'boolean') {
|
|
411
|
+
if (data) {
|
|
412
|
+
outputData = true;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return outputData;
|
|
417
|
+
}
|
|
418
|
+
static processPreload(data : object | null, version : number) {
|
|
419
|
+
|
|
420
|
+
if (!data) {
|
|
421
|
+
return null
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (version === 1) {
|
|
425
|
+
return
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
type outputType = {start : number, stop : number, autoType : boolean, isActive : boolean};
|
|
429
|
+
const setTimeRange = (config: defaultType, itemOutput : outputType) => {
|
|
430
|
+
|
|
431
|
+
if (config.start) {
|
|
432
|
+
|
|
433
|
+
let start = config.start;
|
|
434
|
+
|
|
435
|
+
if (typeof start === 'string') {
|
|
436
|
+
start = parseFloat(start);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
itemOutput.start = start;
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
if (!start) {
|
|
443
|
+
itemOutput.start = 0;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
if (config.stop) {
|
|
448
|
+
|
|
449
|
+
let stop = config.stop;
|
|
450
|
+
|
|
451
|
+
if (typeof stop === 'string') {
|
|
452
|
+
stop = parseFloat(stop);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
itemOutput.stop = stop;
|
|
456
|
+
|
|
457
|
+
if (!stop) {
|
|
458
|
+
itemOutput.stop = 10;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return itemOutput;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
const setPreloadType = (type: defaultType, itemOutput : outputType) => {
|
|
467
|
+
|
|
468
|
+
itemOutput.autoType = true;
|
|
469
|
+
|
|
470
|
+
if (type.onload !== undefined) {
|
|
471
|
+
if (typeof type.onload === 'string' && type.onload === 'false') {
|
|
472
|
+
itemOutput.autoType = false;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
if (typeof type.onload === 'boolean') {
|
|
476
|
+
if (!type.onload) {
|
|
477
|
+
itemOutput.autoType = false;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return itemOutput;
|
|
483
|
+
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
const setActive = (itemOutput : outputType) => {
|
|
487
|
+
itemOutput.isActive = true;
|
|
488
|
+
return itemOutput
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
let itemOutput : outputType = {
|
|
494
|
+
start : 0,
|
|
495
|
+
stop : 10,
|
|
496
|
+
isActive : false,
|
|
497
|
+
autoType : false,
|
|
498
|
+
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
if (typeof data === 'object') {
|
|
502
|
+
if (Object.keys(data).length !== 0) {
|
|
503
|
+
itemOutput = setTimeRange(data, itemOutput);
|
|
504
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
505
|
+
itemOutput = setActive(itemOutput);
|
|
506
|
+
|
|
507
|
+
return itemOutput;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (Object.keys(data).length === 0) {
|
|
511
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
512
|
+
itemOutput = setActive(itemOutput);
|
|
513
|
+
|
|
514
|
+
return itemOutput
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
return false
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (typeof data === 'string' && data !== 'false') {
|
|
521
|
+
|
|
522
|
+
if (data === 'true') {
|
|
523
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
524
|
+
itemOutput = setActive(itemOutput);
|
|
525
|
+
return itemOutput;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (typeof data === 'boolean') {
|
|
532
|
+
if (data) {
|
|
533
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
534
|
+
itemOutput = setActive(itemOutput);
|
|
535
|
+
return itemOutput;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Plyr from "plyr";
|
|
2
2
|
import {TemplateService} from "../../services/TemplateService";
|
|
3
|
-
import {LTPlayerConfig} from "../LTPlayerConfig";
|
|
3
|
+
import {LTPlayerConfig} from "../config/LTPlayerConfig";
|
|
4
4
|
import {IconsService} from "../../services/IconsService";
|
|
5
5
|
import {LTPlayerChapters} from "./LTPlayerChapters";
|
|
6
6
|
import {LTPlayerSettingsControlsManager} from "./LTPlayerSettingsControlsManager";
|
|
@@ -2,7 +2,7 @@ import {LTPlayerPosterPreload} from "./LTPlayerPosterPreload";
|
|
|
2
2
|
import {LTPlayerPoster} from "./LTPlayerPoster";
|
|
3
3
|
import {LTPlayer} from "../LTPlayerType";
|
|
4
4
|
import {LTPlayerDevMethode} from "../LTPlayerDevMethode";
|
|
5
|
-
import {LTPlayerConfig} from "../LTPlayerConfig";
|
|
5
|
+
import {LTPlayerConfig} from "../config/LTPlayerConfig";
|
|
6
6
|
import {TemplateService} from "../../services/TemplateService";
|
|
7
7
|
import {IconsService} from "../../services/IconsService";
|
|
8
8
|
import {LTPlayerPosterEvents} from "./LTPlayerPosterEvents";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {LTPlayerPoster} from "./LTPlayerPoster";
|
|
2
2
|
import Plyr from "plyr";
|
|
3
3
|
import {TemplateService} from "../../services/TemplateService";
|
|
4
|
-
import {LTPlayerConfig} from "../LTPlayerConfig";
|
|
4
|
+
import {LTPlayerConfig} from "../config/LTPlayerConfig";
|
|
5
5
|
import {IconsService} from "../../services/IconsService";
|
|
6
6
|
import {LoaderService} from "../../services/LoaderService";
|
|
7
7
|
import {LTPlayer} from "../LTPlayerType";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {LTPlayer} from "../LTPlayerType";
|
|
2
|
-
import {LTPlayerConfig} from "../LTPlayerConfig";
|
|
2
|
+
import {LTPlayerConfig} from "../config/LTPlayerConfig";
|
|
3
3
|
import {IconsService} from "../../services/IconsService";
|
|
4
4
|
import {TemplateService} from "../../services/TemplateService";
|
|
5
5
|
import {LTPlayerShareEvents} from "./LTPlayerShareEvents";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {LTPlayerConfig} from "../../components/LTPlayerConfig";
|
|
1
|
+
import {LTPlayerConfig} from "../../components/config/LTPlayerConfig";
|
|
2
2
|
import {LTPlayerControls} from "../../components/controls/LTPlayerControls";
|
|
3
3
|
import Plyr from "plyr";
|
|
4
4
|
import {TemplateService} from "../../services/TemplateService";
|
package/src/services/Helper.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {defaultType} from "../global/types/ModuleTypes";
|
|
2
2
|
|
|
3
3
|
export class Helper {
|
|
4
4
|
static getDevice() {
|
|
@@ -28,7 +28,7 @@ export class Helper {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
static processConfigData(videoUrl: string) {
|
|
31
|
+
static processConfigData(videoUrl: string | defaultType) {
|
|
32
32
|
|
|
33
33
|
const regex = /^(http:\/\/|https:\/\/)(player\.vimeo\.com|vimeo\.com|youtu\.be|www\.youtube\.com)\/([\w\/]+)(\?.*)?$/;
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ export class Helper {
|
|
|
36
36
|
let type = 'video';
|
|
37
37
|
let origin = 'video';
|
|
38
38
|
|
|
39
|
-
if ((groupMatch = regex.exec(videoUrl)) !== null) {
|
|
39
|
+
if ((groupMatch = regex.exec(<string>videoUrl)) !== null) {
|
|
40
40
|
groupMatch.forEach((match: string) => {
|
|
41
41
|
if (match !== undefined) {
|
|
42
42
|
if (match.includes('vimeo')) {
|
|
@@ -57,7 +57,7 @@ export class Helper {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
static getEmbeddedID = (url: string) => {
|
|
60
|
+
static getEmbeddedID = (url: string | defaultType) => {
|
|
61
61
|
const urlGroups = url.split('?')[0].split('/');
|
|
62
62
|
if (urlGroups.length > 4) {
|
|
63
63
|
return url.split('?')[0].split('/').slice(-2)[0];
|
|
@@ -66,11 +66,26 @@ export class Helper {
|
|
|
66
66
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
static getEmbeddedHash = (url: string) => {
|
|
69
|
+
static getEmbeddedHash = (url: string | defaultType) => {
|
|
70
70
|
const urlGroups = url.split('?')[0].split('/');
|
|
71
71
|
if (urlGroups.length > 4) {
|
|
72
72
|
return url.split('?')[0].split('/').slice(-1)[0];
|
|
73
73
|
}
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
static isValidHttpUrl(string: string | defaultType) {
|
|
78
|
+
let url;
|
|
79
|
+
|
|
80
|
+
if (typeof string === 'object') {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
url = new URL(string);
|
|
86
|
+
} catch (_) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
90
|
+
}
|
|
76
91
|
}
|
|
@@ -270,8 +270,25 @@ export class ResizeService {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
const version = this.playerInstance.playerConfig.getVersion();
|
|
274
|
+
const observeConfig = this.playerInstance.playerConfig.getObserve();
|
|
275
|
+
|
|
276
|
+
if (observeConfig) {
|
|
277
|
+
if (observeConfig.hasOwnProperty('width') && observeConfig.width) {
|
|
278
|
+
setWidth();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (observeConfig.hasOwnProperty('height') && observeConfig.height) {
|
|
282
|
+
setHeight();
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
setWidth();
|
|
286
|
+
|
|
287
|
+
if (version !== 1) {
|
|
288
|
+
setHeight();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
275
292
|
setClass();
|
|
276
293
|
}
|
|
277
294
|
}
|
|
@@ -8,7 +8,7 @@ import share from '../views/share.handlebars';
|
|
|
8
8
|
import background from '../views/background.handlebars';
|
|
9
9
|
import miniPlayerControls from '../views/controls.handlebars';
|
|
10
10
|
import onloadPoster from '../views/onloadPoster.handlebars';
|
|
11
|
-
import {LTPlayerConfig} from "../components/LTPlayerConfig";
|
|
11
|
+
import {LTPlayerConfig} from "../components/config/LTPlayerConfig";
|
|
12
12
|
import {IconsService} from "./IconsService";
|
|
13
13
|
import {defaultType} from "../global/types/ModuleTypes";
|
|
14
14
|
|