@latest-thinking/lt-player 1.0.4 → 1.0.5-a
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 -3
- 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 +10 -8
- package/src/assets/sass/app.scss +2 -2
- package/src/assets/sass/core/_fonts.scss +5 -5
- package/src/assets/sass/sections/_control.scss +35 -0
- package/src/assets/sass/sections/_poster.scss +3 -0
- package/src/assets/sass/sections/_settings.scss +1 -1
- package/src/assets/sass/sections/_subtitles.scss +4 -0
- package/src/assets/sass/sections/controllers/_botom.scss +15 -5
- package/src/assets/sass/sections/controllers/_mini-player.scss +36 -2
- package/src/assets/sass/sections/controllers/_notification-rewind-forward.scss +70 -11
- package/src/components/LTPlayerDevMethode.ts +23 -3
- package/src/components/LTPlayerManager.ts +12 -5
- package/src/components/LTPlayerSetup.ts +31 -7
- package/src/components/LTPlayerType.ts +58 -11
- package/src/components/addInfo/LTPlayerAdditionalInfoEvents.ts +6 -2
- package/src/components/config/LTPlayerConfig.ts +200 -0
- package/src/components/config/LTPlayerConfigProcessor.ts +546 -0
- package/src/components/controls/LTPlayerChapters.ts +8 -4
- package/src/components/controls/LTPlayerControls.ts +1 -1
- package/src/components/controls/LTPlayerControlsEvents.ts +225 -71
- package/src/components/controls/LTPlayerMini.ts +45 -3
- package/src/components/controls/settings/LTPlayerDesktopSettingsControllers.ts +2 -4
- package/src/components/controls/settings/LTPlayerMobileSettingsControllers.ts +2 -0
- package/src/components/events/LTPlayer.ts +46 -2
- package/src/components/events/LTPlayerDesktop.ts +1 -0
- package/src/components/events/LTPlayerMobile.ts +1 -1
- package/src/components/poster/LTPlayerPoster.ts +2 -2
- package/src/components/poster/LTPlayerPosterEvents.ts +5 -0
- package/src/components/poster/LTPlayerPosterManager.ts +1 -1
- package/src/components/poster/LTPlayerPosterPreload.ts +1 -1
- package/src/components/poster/LTPlayerPosterPreloadEvents.ts +17 -6
- package/src/components/share/LTPlayerShare.ts +1 -1
- package/src/components/share/LTPlayerShareEvents.ts +20 -20
- package/src/global/controllers/LTPlayerController.ts +1 -1
- package/src/services/Helper.ts +20 -5
- package/src/services/IconsService.ts +15 -0
- package/src/services/LTPlayerRotateDeviceService.ts +8 -1
- package/src/services/ResizeService.ts +24 -6
- package/src/services/TemplateService.ts +1 -1
- package/src/views/background.handlebars +1 -1
- package/src/views/controls.handlebars +71 -14
- package/src/views/settings.handlebars +3 -3
- package/src/views/template.handlebars +2 -2
- package/src/components/LTPlayerConfig.ts +0 -398
|
@@ -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) {
|
|
@@ -29,29 +43,23 @@ export namespace LTPlayerControlsEvents {
|
|
|
29
43
|
|
|
30
44
|
playPause(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
31
45
|
|
|
32
|
-
const
|
|
33
|
-
const pauseInfoIcon = instance.plyr.elements.controls.querySelector('.player-state__pause-icon');
|
|
46
|
+
const icons = instance.iconService.getIconsByComponent('playPause') as {play : string, pause: string};
|
|
34
47
|
const playerStateInfo = instance.plyr.elements.controls.querySelector('.player-state');
|
|
48
|
+
const iconSelector: HTMLImageElement = playerStateInfo.querySelector('.player-state__icon');
|
|
35
49
|
|
|
36
50
|
const removeStateButtons = () => {
|
|
37
51
|
setTimeout(() => {
|
|
38
52
|
playerStateInfo.classList.remove('active');
|
|
39
|
-
|
|
40
|
-
playInfoIcon.classList.add('d-none');
|
|
41
|
-
pauseInfoIcon.classList.add('d-none');
|
|
42
|
-
}, 300)
|
|
43
|
-
}, 300)
|
|
44
|
-
|
|
53
|
+
}, 200)
|
|
45
54
|
}
|
|
46
55
|
|
|
47
|
-
|
|
48
56
|
if (instance.plyr.playing) {
|
|
49
|
-
|
|
57
|
+
iconSelector.src = icons.pause;
|
|
50
58
|
playerStateInfo.classList.add('active');
|
|
51
59
|
instance.plyr.togglePlay(false);
|
|
52
60
|
removeStateButtons();
|
|
53
61
|
} else {
|
|
54
|
-
|
|
62
|
+
iconSelector.src = icons.play;
|
|
55
63
|
playerStateInfo.classList.add('active');
|
|
56
64
|
instance.plyr.togglePlay(true);
|
|
57
65
|
removeStateButtons();
|
|
@@ -64,9 +72,58 @@ export namespace LTPlayerControlsEvents {
|
|
|
64
72
|
|
|
65
73
|
animateNotificationOut(selector: Element) {
|
|
66
74
|
selector.classList.remove('animate-in');
|
|
67
|
-
}
|
|
75
|
+
},
|
|
68
76
|
}
|
|
69
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
|
+
}
|
|
70
127
|
|
|
71
128
|
playPauseIconTimeUpdate(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
72
129
|
|
|
@@ -77,14 +134,27 @@ export namespace LTPlayerControlsEvents {
|
|
|
77
134
|
const playIcon = playerContainer.querySelector('.bottom-controller__play-icon');
|
|
78
135
|
const pauseIcon = playerContainer.querySelector('.bottom-controller__pause-icon');
|
|
79
136
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
137
|
+
if (player.isEmbed) {
|
|
138
|
+
player.embed.getPaused().then((paused: any) => {
|
|
139
|
+
if (paused) {
|
|
140
|
+
pauseIcon.classList.add('d-none');
|
|
141
|
+
playIcon.classList.remove('d-none');
|
|
142
|
+
} else {
|
|
143
|
+
playIcon.classList.add('d-none');
|
|
144
|
+
pauseIcon.classList.remove('d-none');
|
|
145
|
+
}
|
|
146
|
+
})
|
|
84
147
|
} else {
|
|
85
|
-
|
|
86
|
-
|
|
148
|
+
if (player.playing) {
|
|
149
|
+
playIcon.classList.add('d-none');
|
|
150
|
+
pauseIcon.classList.remove('d-none');
|
|
151
|
+
} else {
|
|
152
|
+
pauseIcon.classList.add('d-none');
|
|
153
|
+
playIcon.classList.remove('d-none');
|
|
154
|
+
}
|
|
87
155
|
}
|
|
156
|
+
|
|
157
|
+
|
|
88
158
|
}
|
|
89
159
|
}
|
|
90
160
|
|
|
@@ -94,7 +164,9 @@ export namespace LTPlayerControlsEvents {
|
|
|
94
164
|
constructor() {
|
|
95
165
|
this.common = new Common();
|
|
96
166
|
}
|
|
97
|
-
|
|
167
|
+
titleLineBreak(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
168
|
+
this.common.checkTitleBreakWord(instance)
|
|
169
|
+
}
|
|
98
170
|
subtitles(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
99
171
|
|
|
100
172
|
const playerContainer = instance.plyr.elements.container;
|
|
@@ -128,7 +200,7 @@ export namespace LTPlayerControlsEvents {
|
|
|
128
200
|
|
|
129
201
|
|
|
130
202
|
controls.addEventListener('mouseleave', function () {
|
|
131
|
-
controls.classList.remove('plyr__controls-enable')
|
|
203
|
+
// controls.classList.remove('plyr__controls-enable')
|
|
132
204
|
})
|
|
133
205
|
}
|
|
134
206
|
|
|
@@ -166,9 +238,23 @@ export namespace LTPlayerControlsEvents {
|
|
|
166
238
|
}
|
|
167
239
|
|
|
168
240
|
playPauseIcon(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType, type: string) {
|
|
241
|
+
let common = this.common;
|
|
169
242
|
switch (type) {
|
|
170
243
|
case 'timeupdate':
|
|
171
244
|
this.common.playPauseIconTimeUpdate(instance);
|
|
245
|
+
break
|
|
246
|
+
case 'ready':
|
|
247
|
+
const playButton = instance.plyr.elements.controls.querySelector('.play-button');
|
|
248
|
+
if (playButton) {
|
|
249
|
+
playButton.addEventListener('click', function LTPlayerPlayButton() {
|
|
250
|
+
if (instance.plyr.playing) {
|
|
251
|
+
instance.plyr.togglePlay(false);
|
|
252
|
+
} else {
|
|
253
|
+
instance.plyr.togglePlay(true);
|
|
254
|
+
}
|
|
255
|
+
common.playPauseIconTimeUpdate(instance);
|
|
256
|
+
})
|
|
257
|
+
}
|
|
172
258
|
}
|
|
173
259
|
}
|
|
174
260
|
|
|
@@ -180,22 +266,34 @@ export namespace LTPlayerControlsEvents {
|
|
|
180
266
|
if (selectors.forwardArea) {
|
|
181
267
|
selectors.forwardArea.addEventListener('dblclick', function LTPlayerForwardDbClick(event) {
|
|
182
268
|
event.preventDefault();
|
|
269
|
+
|
|
270
|
+
const playerState = selectors.playerControlsContainer.querySelector('.lt-player-notification__notification-button-state');
|
|
271
|
+
|
|
272
|
+
if (playerState && !playerState.classList.contains('d-none')) {
|
|
273
|
+
playerState.classList.add('d-none');
|
|
274
|
+
}
|
|
275
|
+
|
|
183
276
|
common.backwardRewind.animateNotificationIn(selectors.forwardAnimation);
|
|
184
277
|
common.backwardRewind.updateCurrentTime(instance, 10);
|
|
185
278
|
setTimeout(() => {
|
|
186
|
-
common.backwardRewind.animateNotificationOut(selectors.forwardAnimation)
|
|
279
|
+
common.backwardRewind.animateNotificationOut(selectors.forwardAnimation);
|
|
280
|
+
playerState.classList.remove('d-none');
|
|
187
281
|
}, 500)
|
|
188
282
|
})
|
|
189
283
|
|
|
190
284
|
selectors.forwardArea.addEventListener('click', function LTPlayerForwardClick(event) {
|
|
191
285
|
event.preventDefault();
|
|
192
|
-
const volumeControlArea = selectors.playerControlsContainer.querySelector('.bottom-controller__volume_control');
|
|
193
286
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
287
|
+
setTimeout(() => {
|
|
288
|
+
const volumeControlArea = selectors.playerControlsContainer.querySelector('.bottom-controller__volume_control');
|
|
289
|
+
|
|
290
|
+
if (volumeControlArea) {
|
|
291
|
+
if (!volumeControlArea.classList.contains('volume-control-enable')) {
|
|
292
|
+
common.backwardRewind.playPause(instance);
|
|
293
|
+
}
|
|
197
294
|
}
|
|
198
|
-
}
|
|
295
|
+
}, 100)
|
|
296
|
+
|
|
199
297
|
|
|
200
298
|
})
|
|
201
299
|
}
|
|
@@ -204,22 +302,35 @@ export namespace LTPlayerControlsEvents {
|
|
|
204
302
|
|
|
205
303
|
selectors.rewindArea.addEventListener('dblclick', function LTPlayerRewindDbClick(event) {
|
|
206
304
|
event.preventDefault();
|
|
305
|
+
|
|
306
|
+
const playerState = selectors.playerControlsContainer.querySelector('.lt-player-notification__notification-button-state');
|
|
307
|
+
|
|
308
|
+
if (playerState && !playerState.classList.contains('d-none')) {
|
|
309
|
+
playerState.classList.add('d-none');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
|
|
207
313
|
common.backwardRewind.animateNotificationIn(selectors.rewindAnimation);
|
|
208
314
|
common.backwardRewind.updateCurrentTime(instance, -10);
|
|
209
315
|
setTimeout(() => {
|
|
210
|
-
common.backwardRewind.animateNotificationOut(selectors.rewindAnimation)
|
|
316
|
+
common.backwardRewind.animateNotificationOut(selectors.rewindAnimation);
|
|
317
|
+
playerState.classList.remove('d-none');
|
|
211
318
|
}, 500)
|
|
212
319
|
})
|
|
213
320
|
|
|
214
321
|
selectors.rewindArea.addEventListener('click', function LTPlayerRewindClick(event) {
|
|
215
322
|
event.preventDefault();
|
|
216
|
-
const volumeControlArea = selectors.playerControlsContainer.querySelector('.bottom-controller__volume_control');
|
|
217
323
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
324
|
+
setTimeout(() => {
|
|
325
|
+
const volumeControlArea = selectors.playerControlsContainer.querySelector('.bottom-controller__volume_control');
|
|
326
|
+
|
|
327
|
+
if (volumeControlArea) {
|
|
328
|
+
if (!volumeControlArea.classList.contains('volume-control-enable')) {
|
|
329
|
+
common.backwardRewind.playPause(instance);
|
|
330
|
+
}
|
|
221
331
|
}
|
|
222
|
-
}
|
|
332
|
+
}, 100)
|
|
333
|
+
|
|
223
334
|
})
|
|
224
335
|
|
|
225
336
|
}
|
|
@@ -375,27 +486,29 @@ export namespace LTPlayerControlsEvents {
|
|
|
375
486
|
}
|
|
376
487
|
seekBar(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
377
488
|
const playerControlsContainer = instance.plyr.elements.controls;
|
|
378
|
-
const seekBar = playerControlsContainer.querySelector('.plyr__progress__seek');
|
|
489
|
+
const seekBar: HTMLInputElement = playerControlsContainer.querySelector('.plyr__progress__seek');
|
|
379
490
|
const rangeTouch = require('rangetouch');
|
|
380
491
|
rangeTouch.setup(seekBar);
|
|
492
|
+
const __this = this;
|
|
493
|
+
seekBar.addEventListener('change', () => {
|
|
494
|
+
__this.showControls(instance);
|
|
495
|
+
})
|
|
496
|
+
|
|
381
497
|
}
|
|
382
498
|
|
|
383
499
|
controlsTimeShow(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
384
500
|
const playerContainer = instance.plyr.elements.container;
|
|
385
|
-
const
|
|
501
|
+
const playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
|
|
386
502
|
const __this = this;
|
|
503
|
+
if (playerControlsBackground) {
|
|
504
|
+
let mobileEvent: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(playerControlsBackground);
|
|
387
505
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
if (mobileEvent) {
|
|
391
|
-
mobileEvent.on('singletap', function LTPlayerMobileFullScreen() {
|
|
392
|
-
|
|
393
|
-
if (!playerContainer.classList.contains('plyr__controls-enable')) {
|
|
506
|
+
if (mobileEvent) {
|
|
507
|
+
mobileEvent.on('singletap', function LTPlayerMobileBack() {
|
|
394
508
|
__this.showControls(instance);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
509
|
+
})
|
|
510
|
+
}
|
|
397
511
|
}
|
|
398
|
-
|
|
399
512
|
}
|
|
400
513
|
|
|
401
514
|
removePlyrControlsClass(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
@@ -410,11 +523,19 @@ export namespace LTPlayerControlsEvents {
|
|
|
410
523
|
|
|
411
524
|
|
|
412
525
|
showControls(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
413
|
-
|
|
414
526
|
const playerContainer = instance.plyr.elements.container;
|
|
415
527
|
const playerControlsContainer = instance.plyr.elements.controls;
|
|
528
|
+
let playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
|
|
416
529
|
|
|
417
|
-
playerContainer.classList.
|
|
530
|
+
if (playerContainer.classList.contains('plyr--hide-controls')) {
|
|
531
|
+
playerContainer.classList.remove('plyr--hide-controls');
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if (playerControlsBackground) {
|
|
535
|
+
if (!playerControlsBackground.classList.contains('d-none')) {
|
|
536
|
+
playerControlsBackground.classList.add('d-none');
|
|
537
|
+
}
|
|
538
|
+
}
|
|
418
539
|
|
|
419
540
|
if (!playerControlsContainer.classList.contains('plyr__controls-enable')) {
|
|
420
541
|
playerControlsContainer.classList.add('plyr__controls-enable');
|
|
@@ -424,17 +545,32 @@ export namespace LTPlayerControlsEvents {
|
|
|
424
545
|
clearTimeout(this.controlsTimeOut);
|
|
425
546
|
}
|
|
426
547
|
|
|
427
|
-
this.hideControls(instance);
|
|
548
|
+
this.hideControls(instance, false);
|
|
428
549
|
}
|
|
429
550
|
|
|
430
|
-
hideControls(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
551
|
+
hideControls(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType, now: boolean) {
|
|
431
552
|
const playerContainer = instance.plyr.elements.container;
|
|
432
553
|
const playerControlsContainer = instance.plyr.elements.controls;
|
|
433
|
-
|
|
434
|
-
playerControlsContainer.classList.remove('plyr__controls-enable');
|
|
435
|
-
playerContainer.classList.add('plyr--hide-controls');
|
|
436
|
-
}, 4000);
|
|
554
|
+
let playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
|
|
437
555
|
|
|
556
|
+
if (!playerControlsContainer.classList.contains('plyr__controls-enable-addInfo')) {
|
|
557
|
+
|
|
558
|
+
if (now) {
|
|
559
|
+
playerControlsContainer.classList.remove('plyr__controls-enable');
|
|
560
|
+
playerContainer.classList.add('plyr--hide-controls');
|
|
561
|
+
if (!playerControlsContainer.classList.contains('player-lt__modal__mobile-show-modal')) {
|
|
562
|
+
playerControlsBackground.classList.remove('d-none');
|
|
563
|
+
}
|
|
564
|
+
} else {
|
|
565
|
+
this.controlsTimeOut = setTimeout(() => {
|
|
566
|
+
playerControlsContainer.classList.remove('plyr__controls-enable');
|
|
567
|
+
playerContainer.classList.add('plyr--hide-controls');
|
|
568
|
+
if (!playerControlsContainer.classList.contains('player-lt__modal__mobile-show-modal')) {
|
|
569
|
+
playerControlsBackground.classList.remove('d-none');
|
|
570
|
+
}
|
|
571
|
+
}, 4000);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
438
574
|
}
|
|
439
575
|
|
|
440
576
|
fullScreenButtons(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
@@ -451,17 +587,17 @@ export namespace LTPlayerControlsEvents {
|
|
|
451
587
|
}
|
|
452
588
|
}
|
|
453
589
|
playPauseIcon(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType, type: string) {
|
|
454
|
-
|
|
455
590
|
let common = this.common;
|
|
591
|
+
let instanceMobile = this;
|
|
456
592
|
|
|
457
593
|
switch (type) {
|
|
458
594
|
case 'timeupdate':
|
|
459
595
|
common.playPauseIconTimeUpdate(instance);
|
|
460
596
|
break
|
|
461
597
|
case 'ready':
|
|
462
|
-
const playButton = instance.plyr.elements.
|
|
598
|
+
const playButton = instance.plyr.elements.controls.querySelector('.play-button');
|
|
463
599
|
let mobileEvent: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(playButton);
|
|
464
|
-
if (mobileEvent
|
|
600
|
+
if (mobileEvent) {
|
|
465
601
|
mobileEvent.on('singletap', function LTPlayerMobilePLayPauseIcon() {
|
|
466
602
|
if (instance.plyr.playing) {
|
|
467
603
|
instance.plyr.togglePlay(false);
|
|
@@ -469,6 +605,7 @@ export namespace LTPlayerControlsEvents {
|
|
|
469
605
|
instance.plyr.togglePlay(true);
|
|
470
606
|
}
|
|
471
607
|
common.playPauseIconTimeUpdate(instance);
|
|
608
|
+
instanceMobile.showControls(instance);
|
|
472
609
|
});
|
|
473
610
|
}
|
|
474
611
|
}
|
|
@@ -478,33 +615,37 @@ export namespace LTPlayerControlsEvents {
|
|
|
478
615
|
|
|
479
616
|
let common = this.common;
|
|
480
617
|
const selectors = common.backwardRewind.getSelectors(instance);
|
|
481
|
-
const volumeControlArea = selectors.playerControlsContainer.querySelector('.bottom-controller__volume_control');
|
|
482
618
|
|
|
483
619
|
const singleTapAction = () => {
|
|
484
|
-
|
|
485
|
-
if (volumeControlArea) {
|
|
486
|
-
if (!volumeControlArea.classList.contains('volume-control-enable')) {
|
|
487
|
-
common.backwardRewind.playPause(instance);
|
|
488
|
-
instance.playerControl.mobileEvents.showControls(instance);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
620
|
+
instance.playerControl.mobileEvents.hideControls(instance, true);
|
|
492
621
|
}
|
|
493
622
|
|
|
494
623
|
if (selectors.forwardArea) {
|
|
495
624
|
|
|
496
625
|
let mobileEvent: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(selectors.forwardArea);
|
|
497
626
|
|
|
498
|
-
mobileEvent.on('doubletap', function LTPlayerMobileForwardDbClick() {
|
|
627
|
+
mobileEvent.on('doubletap', function LTPlayerMobileForwardDbClick(event) {
|
|
628
|
+
|
|
499
629
|
common.backwardRewind.animateNotificationIn(selectors.forwardAnimation);
|
|
500
630
|
common.backwardRewind.updateCurrentTime(instance, 10);
|
|
501
631
|
setTimeout(() => {
|
|
502
632
|
common.backwardRewind.animateNotificationOut(selectors.forwardAnimation)
|
|
503
633
|
}, 500)
|
|
634
|
+
instance.playerControl.mobileEvents.showControls(instance);
|
|
504
635
|
})
|
|
505
636
|
|
|
506
|
-
mobileEvent.on('singletap', function LTPlayerMobileForwardDbClick() {
|
|
637
|
+
mobileEvent.on('singletap', function LTPlayerMobileForwardDbClick(event) {
|
|
507
638
|
singleTapAction();
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
let mobileEventBackground: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(selectors.forwardAreaBackground);
|
|
642
|
+
|
|
643
|
+
mobileEventBackground.on('doubletap', function LTPlayerMobileForwardDbClickBackground(event) {
|
|
644
|
+
common.backwardRewind.animateNotificationIn(selectors.forwardAnimationBackground);
|
|
645
|
+
common.backwardRewind.updateCurrentTime(instance, 10);
|
|
646
|
+
setTimeout(() => {
|
|
647
|
+
common.backwardRewind.animateNotificationOut(selectors.forwardAnimationBackground)
|
|
648
|
+
}, 500)
|
|
508
649
|
})
|
|
509
650
|
}
|
|
510
651
|
|
|
@@ -512,18 +653,30 @@ export namespace LTPlayerControlsEvents {
|
|
|
512
653
|
|
|
513
654
|
let mobileEvent: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(selectors.rewindArea);
|
|
514
655
|
|
|
515
|
-
mobileEvent.on('doubletap', function LTPlayerMobileRewindDbClick() {
|
|
656
|
+
mobileEvent.on('doubletap', function LTPlayerMobileRewindDbClick(event) {
|
|
657
|
+
|
|
516
658
|
common.backwardRewind.animateNotificationIn(selectors.rewindAnimation);
|
|
517
659
|
common.backwardRewind.updateCurrentTime(instance, -10);
|
|
518
660
|
setTimeout(() => {
|
|
519
661
|
common.backwardRewind.animateNotificationOut(selectors.rewindAnimation)
|
|
520
662
|
}, 500)
|
|
663
|
+
instance.playerControl.mobileEvents.showControls(instance);
|
|
521
664
|
})
|
|
522
665
|
|
|
523
|
-
mobileEvent.on('singletap', function LTPlayerMobileRewindClick() {
|
|
666
|
+
mobileEvent.on('singletap', function LTPlayerMobileRewindClick(event) {
|
|
524
667
|
singleTapAction();
|
|
525
668
|
})
|
|
526
669
|
|
|
670
|
+
let mobileEventBackground: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(selectors.rewindAreaBackground);
|
|
671
|
+
|
|
672
|
+
mobileEventBackground.on('doubletap', function LTPlayerMobileRewindDbClickBackground(event) {
|
|
673
|
+
common.backwardRewind.animateNotificationIn(selectors.rewindAnimationBackground);
|
|
674
|
+
common.backwardRewind.updateCurrentTime(instance, 10);
|
|
675
|
+
setTimeout(() => {
|
|
676
|
+
common.backwardRewind.animateNotificationOut(selectors.rewindAnimationBackground)
|
|
677
|
+
}, 500)
|
|
678
|
+
})
|
|
679
|
+
|
|
527
680
|
}
|
|
528
681
|
}
|
|
529
682
|
|
|
@@ -586,6 +739,7 @@ export namespace LTPlayerControlsEvents {
|
|
|
586
739
|
mobileEvent.on('singletap', function LTPlayerMobileRewindClick() {
|
|
587
740
|
let volumeState = setVolume();
|
|
588
741
|
setVolumeIcon(volumeState);
|
|
742
|
+
instance.playerControl.mobileEvents.showControls(instance);
|
|
589
743
|
})
|
|
590
744
|
|
|
591
745
|
}
|
|
@@ -17,6 +17,10 @@ export class LTPlayerMini {
|
|
|
17
17
|
templateService: TemplateService
|
|
18
18
|
private iconService: IconsService;
|
|
19
19
|
|
|
20
|
+
playerType : string
|
|
21
|
+
|
|
22
|
+
instance : LTPlayer.PortraitType | LTPlayer.LandscapeType
|
|
23
|
+
|
|
20
24
|
constructor() {
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -25,14 +29,30 @@ export class LTPlayerMini {
|
|
|
25
29
|
* @param player
|
|
26
30
|
* @param templateService
|
|
27
31
|
* @param iconService
|
|
32
|
+
* @param playerType
|
|
33
|
+
* @param instance
|
|
28
34
|
*/
|
|
29
|
-
init(player: Plyr, templateService: TemplateService, iconService: IconsService) {
|
|
35
|
+
init(player: Plyr, templateService: TemplateService, iconService: IconsService, playerType : string, instance : LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
36
|
+
this.instance = instance;
|
|
30
37
|
this.templateService = templateService;
|
|
31
38
|
this.iconService = iconService;
|
|
32
39
|
this.player = player;
|
|
40
|
+
this.playerType = playerType;
|
|
33
41
|
this.setup();
|
|
34
42
|
}
|
|
35
43
|
|
|
44
|
+
enterMiniPlayer() {
|
|
45
|
+
this.playerContainer.width = this.player.elements.wrapper.getBoundingClientRect().width;
|
|
46
|
+
this.playerContainer.height = this.player.elements.wrapper.getBoundingClientRect().height;
|
|
47
|
+
this.player.elements.wrapper.classList.add('lt-player-mini-enable');
|
|
48
|
+
this.player.elements.wrapper.classList.add(`lt-player-mini-${this.playerType}`)
|
|
49
|
+
this.setBackground(this.player.elements.wrapper);
|
|
50
|
+
this.addMouseHoverControllers();
|
|
51
|
+
this.addPlayPauseEvents();
|
|
52
|
+
this.setSeekBar();
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
36
56
|
/**
|
|
37
57
|
* Setup mini player
|
|
38
58
|
* @private
|
|
@@ -52,6 +72,7 @@ export class LTPlayerMini {
|
|
|
52
72
|
button.addEventListener('click', function (event) {
|
|
53
73
|
event.preventDefault();
|
|
54
74
|
playerWrapper.classList.add('lt-player-mini-enable');
|
|
75
|
+
playerWrapper.classList.add(`lt-player-mini-${_this.playerType}`)
|
|
55
76
|
_this.setBackground(playerWrapper);
|
|
56
77
|
_this.addMouseHoverControllers();
|
|
57
78
|
_this.addPlayPauseEvents();
|
|
@@ -96,7 +117,19 @@ export class LTPlayerMini {
|
|
|
96
117
|
* @param playerWrapper
|
|
97
118
|
*/
|
|
98
119
|
private setBackground(playerWrapper: HTMLElement) {
|
|
99
|
-
|
|
120
|
+
|
|
121
|
+
let classObserve = false;
|
|
122
|
+
|
|
123
|
+
if (this.instance.playerConfig.getObserve()) {
|
|
124
|
+
if (this.instance.playerConfig.isObserveHeight() !== undefined && !this.instance.playerConfig.isObserveHeight()) {
|
|
125
|
+
classObserve = true;
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
classObserve = true
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const background = this.templateService.getBackGroundTemplate({logo : this.iconService.getLogo(), classObserve : (classObserve) ? 'lt-player-mini-player-observe' : ""});
|
|
132
|
+
|
|
100
133
|
const controls = this.templateService.getControlsMiniPlayer({
|
|
101
134
|
mini_player: 'true',
|
|
102
135
|
icons: this.iconService.getIconsByComponent('controls'),
|
|
@@ -106,6 +139,12 @@ export class LTPlayerMini {
|
|
|
106
139
|
playerWrapper.children[0].insertAdjacentHTML("afterend", controls);
|
|
107
140
|
}
|
|
108
141
|
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
test() {
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
109
148
|
/**
|
|
110
149
|
* Add mini player mouse event
|
|
111
150
|
* @private
|
|
@@ -178,6 +217,7 @@ export class LTPlayerMini {
|
|
|
178
217
|
exitMiniPlayer(player: Plyr) {
|
|
179
218
|
const playerContainer = player.elements.container;
|
|
180
219
|
const exit = playerContainer.querySelector('.lt-player-mini-player-controls__exit');
|
|
220
|
+
let _this = this;
|
|
181
221
|
|
|
182
222
|
if (!exit) {
|
|
183
223
|
return
|
|
@@ -187,7 +227,9 @@ export class LTPlayerMini {
|
|
|
187
227
|
event.preventDefault();
|
|
188
228
|
playerContainer.querySelector('.lt-player-mini-player-controls').remove();
|
|
189
229
|
playerContainer.querySelector('.lt-player-mini-player-background').remove();
|
|
190
|
-
playerContainer.querySelector('.lt-player-mini-enable').classList.remove(
|
|
230
|
+
playerContainer.querySelector('.lt-player-mini-enable').classList.remove(`lt-player-mini-${_this.playerType}`)
|
|
231
|
+
playerContainer.querySelector('.lt-player-mini-enable').classList.remove('lt-player-mini-enable');
|
|
232
|
+
|
|
191
233
|
})
|
|
192
234
|
}
|
|
193
235
|
|
|
@@ -65,13 +65,11 @@ export class LTPlayerDesktopSettingsControllers implements SettingsControlsInter
|
|
|
65
65
|
let values:any = [1,1.25,1.50,2];
|
|
66
66
|
|
|
67
67
|
myRange.oninput = function() {
|
|
68
|
-
|
|
69
|
-
player.speed = parseInt(values[rangeInput.value]);
|
|
70
|
-
|
|
68
|
+
player.speed = parseFloat(values[rangeInput.value]);
|
|
71
69
|
myValue.innerHTML = values[rangeInput.value] + 'x';
|
|
72
70
|
};
|
|
73
71
|
|
|
74
|
-
player.speed =
|
|
72
|
+
player.speed = parseFloat(String(values[0]));
|
|
75
73
|
myValue.innerHTML = values[0] + 'x';
|
|
76
74
|
}
|
|
77
75
|
initSaveButton() {
|
|
@@ -24,6 +24,7 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
24
24
|
let playerSpeedButton = playerControlsContainer.querySelector('.plyr__controls_speed-button');
|
|
25
25
|
playerSpeedButton.innerHTML = `${this.settingsInstance.playerInstance.plyr.speed}`;
|
|
26
26
|
let plyr = this.settingsInstance.playerInstance.plyr;
|
|
27
|
+
let instance = this.settingsInstance.playerInstance;
|
|
27
28
|
|
|
28
29
|
if (playerSpeedButton) {
|
|
29
30
|
let mobileEvent: HammerManager = this.settingsInstance.playerInstance.eventInstance.mobileEvents.setMobileEvent(playerSpeedButton);
|
|
@@ -47,6 +48,7 @@ export class LTPlayerMobileSettingsControllers implements SettingsControlsInterf
|
|
|
47
48
|
plyr.speed = playSpeed;
|
|
48
49
|
playerSpeedButton.innerHTML = `${playSpeed}`;
|
|
49
50
|
|
|
51
|
+
instance.playerControl.mobileEvents.showControls(instance);
|
|
50
52
|
})
|
|
51
53
|
}
|
|
52
54
|
}
|