@latest-thinking/lt-player 1.0.4-n → 1.0.4-p
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/css/lt-player-main.css +1 -1
- package/dist/css/lt-player-main.css.map +1 -1
- 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/assets/sass/sections/_control.scss +22 -0
- package/src/assets/sass/sections/_poster.scss +3 -0
- package/src/assets/sass/sections/controllers/_botom.scss +3 -3
- package/src/assets/sass/sections/controllers/_notification-rewind-forward.scss +42 -3
- package/src/components/LTPlayerSetup.ts +26 -2
- package/src/components/LTPlayerType.ts +11 -7
- package/src/components/config/LTPlayerConfig.ts +184 -0
- package/src/components/config/LTPlayerConfigProcessor.ts +496 -0
- package/src/components/controls/LTPlayerControls.ts +1 -1
- package/src/components/controls/LTPlayerControlsEvents.ts +92 -7
- package/src/components/poster/LTPlayerPoster.ts +1 -1
- package/src/components/poster/LTPlayerPosterEvents.ts +2 -0
- 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/TemplateService.ts +1 -1
- package/src/views/controls.handlebars +56 -3
- package/src/views/template.handlebars +2 -2
- package/src/components/LTPlayerConfig.ts +0 -398
|
@@ -0,0 +1,496 @@
|
|
|
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
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class Processor {
|
|
57
|
+
|
|
58
|
+
static processChapters(data : defaultType, version : number) {
|
|
59
|
+
|
|
60
|
+
if(!data) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (version === 1) {
|
|
65
|
+
data = data.chapters;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (Object.keys(data).length === 0) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return data;
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
static processDefaultConfig(data : defaultType, version : number) {
|
|
78
|
+
let outputData : defaultType = {
|
|
79
|
+
speed : {
|
|
80
|
+
selected : 1,
|
|
81
|
+
captions : false,
|
|
82
|
+
update: true
|
|
83
|
+
},
|
|
84
|
+
captions : {
|
|
85
|
+
active : false
|
|
86
|
+
},
|
|
87
|
+
clickToPlay : false,
|
|
88
|
+
playsinline : true,
|
|
89
|
+
pip : false
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!data) {
|
|
93
|
+
return outputData;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (version === 1) {
|
|
97
|
+
return outputData;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (Object.keys(data).length === 0) {
|
|
101
|
+
return outputData;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
Object.keys(data).forEach(item => {
|
|
105
|
+
if (outputData[item] !== undefined) {
|
|
106
|
+
outputData[item] = data[item];
|
|
107
|
+
} else {
|
|
108
|
+
outputData[item] = data[item];
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
return outputData;
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static processVimeoConfig(data : defaultType, version : number) {
|
|
117
|
+
|
|
118
|
+
let outputData : defaultType = {
|
|
119
|
+
controls: false,
|
|
120
|
+
active: false,
|
|
121
|
+
gesture: 'media',
|
|
122
|
+
transparent: false,
|
|
123
|
+
speed: true,
|
|
124
|
+
portrait: true,
|
|
125
|
+
keyboard: false,
|
|
126
|
+
title: false,
|
|
127
|
+
byline: false,
|
|
128
|
+
playsinline: true,
|
|
129
|
+
background: true
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (version === 1) {
|
|
133
|
+
return outputData
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!data) {
|
|
137
|
+
return outputData;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (Object.keys(data).length === 0){
|
|
141
|
+
return outputData;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
Object.keys(data).forEach(item => {
|
|
145
|
+
if (outputData[item] !== undefined) {
|
|
146
|
+
outputData[item] = data[item];
|
|
147
|
+
} else {
|
|
148
|
+
outputData[item] = data[item];
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
return outputData;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static processShareData(data : defaultType, version : number) {
|
|
156
|
+
if (!data) {
|
|
157
|
+
return null
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (version === 1) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
type shareDataConfig = {
|
|
165
|
+
canonicalUrl : string,
|
|
166
|
+
embedUrl : string,
|
|
167
|
+
title : string
|
|
168
|
+
} | null
|
|
169
|
+
|
|
170
|
+
let outputData : shareDataConfig = {
|
|
171
|
+
canonicalUrl : undefined,
|
|
172
|
+
embedUrl : undefined,
|
|
173
|
+
title : undefined
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (Object.keys(data).length === 0) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (data.canonicalUrl !== undefined) {
|
|
181
|
+
outputData.canonicalUrl = data.canonicalUrl;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (data.embedUrl !== undefined) {
|
|
185
|
+
outputData.embedUrl = data.embedUrl;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (data.title !== undefined) {
|
|
189
|
+
outputData.title = data.title;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return outputData;
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static processPlayerContainer(data : Element | defaultType, version : number) {
|
|
197
|
+
if (!data) {
|
|
198
|
+
return null
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (version === 1) {
|
|
202
|
+
return (data as defaultType).playerContainer;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return data;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
static processVideoUrl(data : string | defaultType, version : number) {
|
|
209
|
+
|
|
210
|
+
if (!data) {
|
|
211
|
+
return null
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
if (version === 1) {
|
|
216
|
+
if (typeof data === 'object') {
|
|
217
|
+
data = data.sources.video_id;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
type configData = {videoUrl : string, videoType : string, embedId : string, embedHash : string, origin : string};
|
|
222
|
+
|
|
223
|
+
let outputData : configData = {
|
|
224
|
+
videoUrl : undefined,
|
|
225
|
+
videoType : undefined,
|
|
226
|
+
embedHash : undefined,
|
|
227
|
+
embedId : undefined,
|
|
228
|
+
origin : undefined
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (!Helper.isValidHttpUrl(data)) {
|
|
232
|
+
console.error(`Please insert valid url video url videoURL : ${data}`);
|
|
233
|
+
return outputData
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const urlVideoData: urlDataType = Helper.processConfigData(data);
|
|
237
|
+
|
|
238
|
+
const mapVideoData = (data: string | defaultType, urlVideoData: urlDataType, outputData: configData) => {
|
|
239
|
+
|
|
240
|
+
if (typeof data === "string") {
|
|
241
|
+
outputData.videoUrl = data;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (urlVideoData.origin) {
|
|
245
|
+
outputData.origin = urlVideoData.origin;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (urlVideoData.type) {
|
|
249
|
+
outputData.videoType = urlVideoData.type.toLowerCase()
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (urlVideoData.type === 'embedded') {
|
|
253
|
+
const embedID = Helper.getEmbeddedID(data);
|
|
254
|
+
|
|
255
|
+
if (embedID) {
|
|
256
|
+
outputData.embedId = embedID;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const embedHash = Helper.getEmbeddedHash(data);
|
|
260
|
+
|
|
261
|
+
if (embedHash) {
|
|
262
|
+
outputData.embedHash = embedHash;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return outputData;
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
outputData = mapVideoData(data, urlVideoData, outputData);
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
return outputData;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
static processVideoParagraph(data : string | defaultType, version : number) {
|
|
278
|
+
|
|
279
|
+
if (!data) {
|
|
280
|
+
return null
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
let outputData = undefined;
|
|
284
|
+
|
|
285
|
+
if (version === 1) {
|
|
286
|
+
if (typeof data === 'object') {
|
|
287
|
+
data = data.author;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (typeof data === 'string' && /[a-zA-Z]/.test(data)){
|
|
292
|
+
outputData = data;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return outputData;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
static processPosterImage(data: string | defaultType, version : number) {
|
|
299
|
+
|
|
300
|
+
if (!data) {
|
|
301
|
+
return null
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (version === 1) {
|
|
305
|
+
if (typeof data === 'object') {
|
|
306
|
+
return data.poster;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
let check = Helper.isValidHttpUrl(data);
|
|
311
|
+
|
|
312
|
+
if (check) {
|
|
313
|
+
return data;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
console.error(`Set valid url for poster image config item => posterImage : ${data} `);
|
|
317
|
+
return undefined;
|
|
318
|
+
}
|
|
319
|
+
static processVideoTitle(data : string | defaultType, version : number) {
|
|
320
|
+
|
|
321
|
+
if (!data) {
|
|
322
|
+
return null
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
let outputData = undefined;
|
|
326
|
+
|
|
327
|
+
if (version === 1) {
|
|
328
|
+
if (typeof data === 'object') {
|
|
329
|
+
data = data.title;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (data) {
|
|
334
|
+
if (typeof data === 'string' && /[a-zA-Z]/.test(data)){
|
|
335
|
+
outputData = data;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return outputData;
|
|
340
|
+
}
|
|
341
|
+
static processAutoPlay(data : boolean | string | object, version : number) {
|
|
342
|
+
|
|
343
|
+
if (!data) {
|
|
344
|
+
return null
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
let outputData : boolean = false;
|
|
348
|
+
|
|
349
|
+
if (version === 1) {
|
|
350
|
+
return outputData;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
if (typeof data === 'string') {
|
|
355
|
+
if (data === 'true') {
|
|
356
|
+
outputData = true;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (typeof data === 'boolean') {
|
|
361
|
+
if (data) {
|
|
362
|
+
outputData = true;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return outputData;
|
|
367
|
+
}
|
|
368
|
+
static processPreload(data : object | null, version : number) {
|
|
369
|
+
|
|
370
|
+
if (!data) {
|
|
371
|
+
return null
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (version === 1) {
|
|
375
|
+
return
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
type outputType = {start : number, stop : number, autoType : boolean, isActive : boolean};
|
|
379
|
+
const setTimeRange = (config: defaultType, itemOutput : outputType) => {
|
|
380
|
+
|
|
381
|
+
if (config.start) {
|
|
382
|
+
|
|
383
|
+
let start = config.start;
|
|
384
|
+
|
|
385
|
+
if (typeof start === 'string') {
|
|
386
|
+
start = parseFloat(start);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
itemOutput.start = start;
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
if (!start) {
|
|
393
|
+
itemOutput.start = 0;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (config.stop) {
|
|
398
|
+
|
|
399
|
+
let stop = config.stop;
|
|
400
|
+
|
|
401
|
+
if (typeof stop === 'string') {
|
|
402
|
+
stop = parseFloat(stop);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
itemOutput.stop = stop;
|
|
406
|
+
|
|
407
|
+
if (!stop) {
|
|
408
|
+
itemOutput.stop = 10;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return itemOutput;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const setPreloadType = (type: defaultType, itemOutput : outputType) => {
|
|
417
|
+
|
|
418
|
+
itemOutput.autoType = true;
|
|
419
|
+
|
|
420
|
+
if (type.onload !== undefined) {
|
|
421
|
+
if (typeof type.onload === 'string' && type.onload === 'false') {
|
|
422
|
+
itemOutput.autoType = false;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (typeof type.onload === 'boolean') {
|
|
426
|
+
if (!type.onload) {
|
|
427
|
+
itemOutput.autoType = false;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return itemOutput;
|
|
433
|
+
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const setActive = (itemOutput : outputType) => {
|
|
437
|
+
itemOutput.isActive = true;
|
|
438
|
+
return itemOutput
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
let itemOutput : outputType = {
|
|
444
|
+
start : 0,
|
|
445
|
+
stop : 10,
|
|
446
|
+
isActive : false,
|
|
447
|
+
autoType : false,
|
|
448
|
+
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
if (typeof data === 'object') {
|
|
452
|
+
if (Object.keys(data).length !== 0) {
|
|
453
|
+
itemOutput = setTimeRange(data, itemOutput);
|
|
454
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
455
|
+
itemOutput = setActive(itemOutput);
|
|
456
|
+
|
|
457
|
+
return itemOutput;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
if (Object.keys(data).length === 0) {
|
|
461
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
462
|
+
itemOutput = setActive(itemOutput);
|
|
463
|
+
|
|
464
|
+
return itemOutput
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
return false
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if (typeof data === 'string' && data !== 'false') {
|
|
471
|
+
|
|
472
|
+
if (data === 'true') {
|
|
473
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
474
|
+
itemOutput = setActive(itemOutput);
|
|
475
|
+
return itemOutput;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (typeof data === 'boolean') {
|
|
482
|
+
if (data) {
|
|
483
|
+
itemOutput = setPreloadType(data, itemOutput);
|
|
484
|
+
itemOutput = setActive(itemOutput);
|
|
485
|
+
return itemOutput;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
|
|
@@ -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";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {LTPlayer} from "../LTPlayerType";
|
|
2
2
|
import {plyr} from "../../global/types/ModuleTypes";
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
export namespace LTPlayerControlsEvents {
|
|
6
5
|
|
|
7
6
|
export class Common {
|
|
@@ -9,14 +8,29 @@ export namespace LTPlayerControlsEvents {
|
|
|
9
8
|
backwardRewind = {
|
|
10
9
|
|
|
11
10
|
getSelectors(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
let selectors = {
|
|
13
13
|
playerContainer: instance.plyr.elements.container,
|
|
14
14
|
playerControlsContainer: instance.plyr.elements.controls,
|
|
15
15
|
forwardArea: instance.plyr.elements.controls.querySelector('.lt-player-forward-area'),
|
|
16
16
|
rewindArea: instance.plyr.elements.controls.querySelector('.lt-player-rewind-area'),
|
|
17
17
|
forwardAnimation: instance.plyr.elements.controls.querySelector('.lt-player-forward'),
|
|
18
|
-
rewindAnimation: instance.plyr.elements.controls.querySelector('.lt-player-rewind')
|
|
19
|
-
|
|
18
|
+
rewindAnimation: instance.plyr.elements.controls.querySelector('.lt-player-rewind'),
|
|
19
|
+
forwardAreaBackground: null as Element,
|
|
20
|
+
rewindAreaBackground: null as Element,
|
|
21
|
+
forwardAnimationBackground: null as Element,
|
|
22
|
+
rewindAnimationBackground: null as Element,
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (instance.playerConfig.getDevice() === 'mobile') {
|
|
27
|
+
selectors.forwardAreaBackground = instance.plyr.elements.container.querySelector('.plyr__controls__mobile-background').querySelector('.lt-player-forward-area')
|
|
28
|
+
selectors.rewindAreaBackground = instance.plyr.elements.container.querySelector('.plyr__controls__mobile-background').querySelector('.lt-player-rewind-area')
|
|
29
|
+
selectors.forwardAnimationBackground = instance.plyr.elements.container.querySelector('.plyr__controls__mobile-background').querySelector('.lt-player-forward')
|
|
30
|
+
selectors.rewindAnimationBackground = instance.plyr.elements.container.querySelector('.plyr__controls__mobile-background').querySelector('.lt-player-rewind')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return selectors
|
|
20
34
|
},
|
|
21
35
|
|
|
22
36
|
updateCurrentTime(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType ,time: number) {
|
|
@@ -58,9 +72,58 @@ export namespace LTPlayerControlsEvents {
|
|
|
58
72
|
|
|
59
73
|
animateNotificationOut(selector: Element) {
|
|
60
74
|
selector.classList.remove('animate-in');
|
|
61
|
-
}
|
|
75
|
+
},
|
|
62
76
|
}
|
|
63
77
|
|
|
78
|
+
checkTitleBreakWord(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
79
|
+
const controlsSelector = instance.plyr.elements.controls;
|
|
80
|
+
const videoTitle = controlsSelector.querySelector('.poster-paragraph__content');
|
|
81
|
+
const readButton = controlsSelector.querySelector('.poster-paragraph__button');
|
|
82
|
+
|
|
83
|
+
if (!videoTitle) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (videoTitle.scrollHeight <= videoTitle.clientHeight) {
|
|
88
|
+
readButton.classList.add('d-none');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const heightContent = videoTitle.scrollHeight;
|
|
93
|
+
|
|
94
|
+
const openHide = () => {
|
|
95
|
+
|
|
96
|
+
let inlineStyleElement = videoTitle as unknown as ElementCSSInlineStyle
|
|
97
|
+
|
|
98
|
+
if (videoTitle.classList.contains('open-content')) {
|
|
99
|
+
inlineStyleElement.style.maxHeight = null;
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
videoTitle.classList.remove('open-content');
|
|
102
|
+
}, 300)
|
|
103
|
+
readButton.innerHTML = 'Read more'
|
|
104
|
+
} else {
|
|
105
|
+
readButton.innerHTML = 'Hide'
|
|
106
|
+
inlineStyleElement.style.maxHeight = `${heightContent}px`;
|
|
107
|
+
videoTitle.classList.add('open-content');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (readButton) {
|
|
112
|
+
|
|
113
|
+
if (instance.playerConfig.getDevice() === 'mobile') {
|
|
114
|
+
let mobileEvent: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(readButton);
|
|
115
|
+
mobileEvent.on('singletap', function LTPlayerMobileShowHideTitle() {
|
|
116
|
+
openHide();
|
|
117
|
+
instance.playerControl.mobileEvents.showControls(instance)
|
|
118
|
+
})
|
|
119
|
+
} else {
|
|
120
|
+
readButton.addEventListener('click', function LTPlayerTitleButton() {
|
|
121
|
+
openHide();
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
64
127
|
|
|
65
128
|
playPauseIconTimeUpdate(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
66
129
|
|
|
@@ -88,6 +151,9 @@ export namespace LTPlayerControlsEvents {
|
|
|
88
151
|
constructor() {
|
|
89
152
|
this.common = new Common();
|
|
90
153
|
}
|
|
154
|
+
titleLineBreak(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
155
|
+
this.common.checkTitleBreakWord(instance)
|
|
156
|
+
}
|
|
91
157
|
subtitles(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
92
158
|
|
|
93
159
|
const playerContainer = instance.plyr.elements.container;
|
|
@@ -121,7 +187,7 @@ export namespace LTPlayerControlsEvents {
|
|
|
121
187
|
|
|
122
188
|
|
|
123
189
|
controls.addEventListener('mouseleave', function () {
|
|
124
|
-
controls.classList.remove('plyr__controls-enable')
|
|
190
|
+
// controls.classList.remove('plyr__controls-enable')
|
|
125
191
|
})
|
|
126
192
|
}
|
|
127
193
|
|
|
@@ -557,6 +623,16 @@ export namespace LTPlayerControlsEvents {
|
|
|
557
623
|
|
|
558
624
|
mobileEvent.on('singletap', function LTPlayerMobileForwardDbClick(event) {
|
|
559
625
|
singleTapAction();
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
let mobileEventBackground: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(selectors.forwardAreaBackground);
|
|
629
|
+
|
|
630
|
+
mobileEventBackground.on('doubletap', function LTPlayerMobileForwardDbClickBackground(event) {
|
|
631
|
+
common.backwardRewind.animateNotificationIn(selectors.forwardAnimationBackground);
|
|
632
|
+
common.backwardRewind.updateCurrentTime(instance, 10);
|
|
633
|
+
setTimeout(() => {
|
|
634
|
+
common.backwardRewind.animateNotificationOut(selectors.forwardAnimationBackground)
|
|
635
|
+
}, 500)
|
|
560
636
|
})
|
|
561
637
|
}
|
|
562
638
|
|
|
@@ -575,10 +651,19 @@ export namespace LTPlayerControlsEvents {
|
|
|
575
651
|
})
|
|
576
652
|
|
|
577
653
|
mobileEvent.on('singletap', function LTPlayerMobileRewindClick(event) {
|
|
578
|
-
|
|
579
654
|
singleTapAction();
|
|
580
655
|
})
|
|
581
656
|
|
|
657
|
+
let mobileEventBackground: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(selectors.rewindAreaBackground);
|
|
658
|
+
|
|
659
|
+
mobileEventBackground.on('doubletap', function LTPlayerMobileRewindDbClickBackground(event) {
|
|
660
|
+
common.backwardRewind.animateNotificationIn(selectors.rewindAnimationBackground);
|
|
661
|
+
common.backwardRewind.updateCurrentTime(instance, 10);
|
|
662
|
+
setTimeout(() => {
|
|
663
|
+
common.backwardRewind.animateNotificationOut(selectors.rewindAnimationBackground)
|
|
664
|
+
}, 500)
|
|
665
|
+
})
|
|
666
|
+
|
|
582
667
|
}
|
|
583
668
|
}
|
|
584
669
|
|
|
@@ -87,6 +87,7 @@ export namespace LTPlayerPosterEvents {
|
|
|
87
87
|
common.poster.getButtons(instance)?.forEach(button => {
|
|
88
88
|
button.addEventListener('click', function LTPlayerPosterButtons(event) {
|
|
89
89
|
event.preventDefault();
|
|
90
|
+
instance.playerControl.desktopEvents.titleLineBreak(instance);
|
|
90
91
|
common.poster.reset(instance);
|
|
91
92
|
})
|
|
92
93
|
});
|
|
@@ -108,6 +109,7 @@ export namespace LTPlayerPosterEvents {
|
|
|
108
109
|
|
|
109
110
|
if (mobileEvent) {
|
|
110
111
|
mobileEvent.on('singletap', function LTPlayerMobilePosterButtons() {
|
|
112
|
+
instance.playerControl.desktopEvents.titleLineBreak(instance);
|
|
111
113
|
|
|
112
114
|
common.poster.reset(instance);
|
|
113
115
|
|
|
@@ -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";
|