@latest-thinking/lt-player 1.0.7 → 1.0.8
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 +2 -1
- package/src/assets/sass/abstracts/_mixins.scss +38 -0
- package/src/assets/sass/abstracts/_variables.scss +5 -0
- package/src/assets/sass/app.scss +22 -1
- package/src/assets/sass/components/_modal.scss +39 -24
- package/src/assets/sass/core/_player.scss +24 -2
- package/src/assets/sass/sections/_additional-info.scss +7 -0
- package/src/assets/sass/sections/_poster.scss +251 -177
- package/src/assets/sass/sections/_settings.scss +6 -4
- package/src/assets/sass/sections/_share.scss +2 -8
- package/src/assets/sass/sections/controllers/_botom.scss +1 -0
- package/src/components/LTPlayerHls.ts +10 -1
- package/src/components/LTPlayerSetup.ts +7 -0
- package/src/components/LTPlayerType.ts +6 -1
- package/src/components/addInfo/LTPlayerAddInfoDesktop.ts +43 -15
- package/src/components/addInfo/LTPlayerAddInfoMobile.ts +60 -57
- package/src/components/config/LTPlayerConfigProcessor.ts +1 -1
- package/src/components/controls/LTPlayerControlsEvents.ts +94 -59
- package/src/components/events/LTPlayerCommon.ts +0 -4
- package/src/components/events/LTPlayerDesktop.ts +3 -3
- package/src/components/events/LTPlayerMobile.ts +8 -10
- package/src/components/poster/LTPlayerPoster.ts +6 -1
- package/src/components/poster/LTPlayerPosterEvents.ts +41 -28
- package/src/components/share/LTPlayerShareDesktop.ts +14 -3
- package/src/index.ts +4 -9
- package/src/services/Helper.ts +27 -0
- package/src/services/ResizeService.ts +66 -36
- package/src/views/additionalInfo.handlebars +11 -1
- package/src/views/controls.handlebars +4 -4
- package/src/views/poster.handlebars +43 -10
- package/src/views/share.handlebars +2 -2
- package/src/views/template.handlebars +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {LTPLayerAddInfo} from "./LTPlayerAddInfoManager";
|
|
2
2
|
import {additionalInformation} from "../../global/types/ModuleTypes";
|
|
3
|
+
import {LTPlayer} from "../LTPlayerType";
|
|
4
|
+
import {LoaderService} from "../../services/LoaderService";
|
|
3
5
|
|
|
4
6
|
export class LTPlayerAddInfoDesktop {
|
|
5
|
-
set(controller: LTPLayerAddInfo.Controller) {
|
|
7
|
+
set(controller: LTPLayerAddInfo.Controller, type: string) {
|
|
6
8
|
|
|
7
9
|
const playerContainer = controller.plyr.elements.container;
|
|
8
10
|
const playerControlsContainer = controller.plyr.elements.controls;
|
|
@@ -10,7 +12,6 @@ export class LTPlayerAddInfoDesktop {
|
|
|
10
12
|
let additionalInfoBodyIn: Element = playerControlsContainer.querySelector('.lt-player__additional-info');
|
|
11
13
|
let instance = controller;
|
|
12
14
|
|
|
13
|
-
|
|
14
15
|
const getInfoButtons = (selector: Element): NodeList => {
|
|
15
16
|
|
|
16
17
|
if (!selector) {
|
|
@@ -24,7 +25,7 @@ export class LTPlayerAddInfoDesktop {
|
|
|
24
25
|
const infoButtonsOut: NodeList = getInfoButtons(additionalInfoBodyOut);
|
|
25
26
|
const infoButtonsIn: NodeList = getInfoButtons(additionalInfoBodyIn);
|
|
26
27
|
|
|
27
|
-
if (
|
|
28
|
+
if (type == 'in') {
|
|
28
29
|
buttons = infoButtonsIn;
|
|
29
30
|
} else {
|
|
30
31
|
buttons = infoButtonsOut;
|
|
@@ -34,24 +35,24 @@ export class LTPlayerAddInfoDesktop {
|
|
|
34
35
|
return
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
const
|
|
38
|
+
const createInformationModal = (info: additionalInformation, key: string) => {
|
|
38
39
|
|
|
39
40
|
let modalTemplate = null;
|
|
40
41
|
|
|
41
42
|
if (typeof info === 'object') {
|
|
42
43
|
modalTemplate = controller.templateService.getAdditionalInfo({
|
|
43
|
-
desktop
|
|
44
|
-
modal
|
|
45
|
-
id
|
|
46
|
-
object_data
|
|
47
|
-
[key]
|
|
44
|
+
desktop: true,
|
|
45
|
+
modal: true,
|
|
46
|
+
id: `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
|
|
47
|
+
object_data: true,
|
|
48
|
+
[key]: info
|
|
48
49
|
})
|
|
49
50
|
} else {
|
|
50
51
|
modalTemplate = controller.templateService.getAdditionalInfo({
|
|
51
|
-
desktop
|
|
52
|
-
modal
|
|
53
|
-
id
|
|
54
|
-
data
|
|
52
|
+
desktop: true,
|
|
53
|
+
modal: true,
|
|
54
|
+
id: `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
|
|
55
|
+
data: info
|
|
55
56
|
})
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -75,14 +76,21 @@ export class LTPlayerAddInfoDesktop {
|
|
|
75
76
|
|
|
76
77
|
if (modal) {
|
|
77
78
|
modal.classList.add('player-lt__show-modal');
|
|
79
|
+
document.body.classList.add('overflow-hidden-body-important');
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
window.Player.players.forEach(
|
|
82
|
+
window.Player.players.forEach(item => {
|
|
83
|
+
if (item.plyr.playing) {
|
|
84
|
+
instance.playerInstance.pausedPlayer = item.plyr;
|
|
85
|
+
item.plyr.pause();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
})
|
|
81
89
|
})
|
|
82
90
|
})
|
|
83
91
|
}
|
|
84
92
|
|
|
85
|
-
windowDesktopEvents(event: MouseEvent) {
|
|
93
|
+
windowDesktopEvents(event: MouseEvent, instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
86
94
|
const modals = document.querySelectorAll('.player-lt__modal');
|
|
87
95
|
if (modals.length !== 0) {
|
|
88
96
|
modals.forEach(modal => {
|
|
@@ -90,7 +98,27 @@ export class LTPlayerAddInfoDesktop {
|
|
|
90
98
|
let target = event.target as HTMLElement;
|
|
91
99
|
if (target.classList.contains('player-lt__show-modal') || target.classList.contains('player-lt__close-button')) {
|
|
92
100
|
modal.classList.remove('player-lt__show-modal');
|
|
101
|
+
document.body.classList.remove('overflow-hidden-body-important');
|
|
93
102
|
document.querySelectorAll(".player-lt__modal").forEach(el => el.remove());
|
|
103
|
+
|
|
104
|
+
window.Player.players.forEach(item => {
|
|
105
|
+
if (item.pausedPlayer !== undefined) {
|
|
106
|
+
if (item.pausedPlayer.isEmbed) {
|
|
107
|
+
item.pausedPlayer.embed.play().then(function () {
|
|
108
|
+
return;
|
|
109
|
+
}).catch(function () {
|
|
110
|
+
// an error occurred
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (item.pausedPlayer.isHTML5) {
|
|
115
|
+
|
|
116
|
+
item.pausedPlayer.play();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
})
|
|
94
122
|
}
|
|
95
123
|
}
|
|
96
124
|
})
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {LTPLayerAddInfo} from "./LTPlayerAddInfoManager";
|
|
2
2
|
import {additionalInformation} from "../../global/types/ModuleTypes";
|
|
3
|
+
import {LTPlayer} from "../LTPlayerType";
|
|
3
4
|
|
|
4
5
|
export class LTPlayerAddInfoMobile {
|
|
5
6
|
set(controller: LTPLayerAddInfo.Controller) {
|
|
7
|
+
|
|
6
8
|
const playerContainer = controller.plyr.elements.container;
|
|
7
|
-
const playerControlsContainer = controller.plyr.elements.controls;
|
|
8
9
|
let additionalInfoBody: Element = playerContainer.querySelector('.lt-player__additional-info-mobile');
|
|
9
10
|
let instance = controller;
|
|
10
11
|
let __this = this;
|
|
@@ -15,35 +16,28 @@ export class LTPlayerAddInfoMobile {
|
|
|
15
16
|
return
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
+
const createInformationModal = (info: additionalInformation, key: string) => {
|
|
20
|
+
|
|
19
21
|
let modalTemplate = null;
|
|
20
22
|
|
|
21
23
|
if (typeof info === 'object') {
|
|
22
24
|
modalTemplate = controller.templateService.getAdditionalInfo({
|
|
23
|
-
|
|
24
|
-
modal
|
|
25
|
-
|
|
26
|
-
object_data
|
|
27
|
-
[key]
|
|
25
|
+
desktop: true,
|
|
26
|
+
modal: true,
|
|
27
|
+
id: `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
|
|
28
|
+
object_data: true,
|
|
29
|
+
[key]: info
|
|
28
30
|
})
|
|
29
31
|
} else {
|
|
30
32
|
modalTemplate = controller.templateService.getAdditionalInfo({
|
|
31
|
-
|
|
32
|
-
modal
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
desktop: true,
|
|
34
|
+
modal: true,
|
|
35
|
+
id: `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
|
|
36
|
+
data: info
|
|
35
37
|
})
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
modal.classList.add('lt-player-mobile-add-info-modal')
|
|
40
|
-
modal.innerHTML = modalTemplate;
|
|
41
|
-
|
|
42
|
-
const body = document.querySelector('body');
|
|
43
|
-
|
|
44
|
-
if (body) {
|
|
45
|
-
body.appendChild(modal);
|
|
46
|
-
}
|
|
40
|
+
document.querySelector('body').insertAdjacentHTML("afterend", modalTemplate);
|
|
47
41
|
}
|
|
48
42
|
|
|
49
43
|
buttons.forEach((button: HTMLElement) => {
|
|
@@ -52,59 +46,68 @@ export class LTPlayerAddInfoMobile {
|
|
|
52
46
|
mobileEvent.on('singletap', function LTPlayerMobileAdditionalInfoButtons(event) {
|
|
53
47
|
event.preventDefault();
|
|
54
48
|
|
|
55
|
-
controller.playerInstance.plyr.elements.controls.classList.add('plyr__controls-enable-addInfo');
|
|
56
|
-
|
|
57
49
|
let targetModal = button.dataset.ltTarget;
|
|
58
50
|
let data = instance.additionalData;
|
|
59
51
|
|
|
60
|
-
|
|
61
52
|
if (data[targetModal] !== undefined) {
|
|
62
53
|
createInformationModal(data[targetModal], targetModal)
|
|
63
54
|
}
|
|
64
55
|
|
|
65
|
-
|
|
56
|
+
let modal = document.querySelector(`.lt-modal-${targetModal}-${instance.playerInstance.playerConfig.getPlayerId()}`);
|
|
66
57
|
|
|
67
|
-
|
|
58
|
+
if (modal) {
|
|
59
|
+
modal.classList.add('player-lt__show-modal');
|
|
60
|
+
document.body.classList.add('overflow-hidden-body-important');
|
|
61
|
+
}
|
|
68
62
|
|
|
69
|
-
|
|
63
|
+
window.Player.players.forEach(item => {
|
|
64
|
+
if (item.plyr.playing) {
|
|
65
|
+
instance.playerInstance.pausedPlayer = item.plyr;
|
|
66
|
+
item.plyr.pause();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
__this.closeModal(controller);
|
|
72
72
|
})
|
|
73
73
|
}
|
|
74
74
|
})
|
|
75
|
-
|
|
76
|
-
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
77
|
+
closeModal(controller: LTPLayerAddInfo.Controller) {
|
|
78
|
+
const modals = document.querySelectorAll('.player-lt__modal');
|
|
79
|
+
|
|
80
|
+
if (modals.length !== 0) {
|
|
81
|
+
modals.forEach(modal => {
|
|
82
|
+
const mobileEvent: HammerManager = controller.playerInstance.eventInstance.mobileEvents.setMobileEvent(modal);
|
|
83
|
+
mobileEvent.on('singletap', function(event) {
|
|
84
|
+
const target = event.target;
|
|
85
|
+
if (modal.classList.contains('player-lt__show-modal')) {
|
|
86
|
+
if (target.classList.contains('player-lt__show-modal') || target.classList.contains('player-lt__close-button')) {
|
|
87
|
+
modal.classList.remove('player-lt__show-modal');
|
|
88
|
+
document.body.classList.remove('overflow-hidden-body-important');
|
|
89
|
+
document.querySelectorAll(".player-lt__modal").forEach(el => el.remove());
|
|
90
|
+
window.Player.players.forEach(item => {
|
|
91
|
+
if (item.pausedPlayer !== undefined) {
|
|
92
|
+
if (item.pausedPlayer.isEmbed) {
|
|
93
|
+
item.pausedPlayer.embed.play().then(function () {
|
|
94
|
+
return;
|
|
95
|
+
}).catch(function () {
|
|
96
|
+
// an error occurred
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (item.pausedPlayer.isHTML5) {
|
|
101
|
+
item.pausedPlayer.play();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
105
108
|
}
|
|
106
|
-
})
|
|
107
|
-
}
|
|
109
|
+
});
|
|
110
|
+
})
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {LTPlayer} from "../LTPlayerType";
|
|
2
2
|
import {plyr} from "../../global/types/ModuleTypes";
|
|
3
|
+
import * as events from "events";
|
|
3
4
|
|
|
4
5
|
export namespace LTPlayerControlsEvents {
|
|
5
6
|
|
|
@@ -122,7 +123,6 @@ export namespace LTPlayerControlsEvents {
|
|
|
122
123
|
})
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
playPauseIconTimeUpdate(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
@@ -154,21 +154,32 @@ export namespace LTPlayerControlsEvents {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
|
|
158
157
|
}
|
|
159
|
-
}
|
|
160
158
|
|
|
161
|
-
|
|
159
|
+
subtitlesShow(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
160
|
+
const playerContainer = instance.plyr.elements.container;
|
|
161
|
+
const playerControls = instance.plyr.elements.controls;
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
const captions = playerContainer.querySelector('.plyr__captions');
|
|
164
|
+
|
|
165
|
+
let checkCaptions = (instance.plyr as plyr).captions.active;
|
|
166
|
+
|
|
167
|
+
if (!checkCaptions) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!captions) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (!playerControls.classList.contains('plyr__controls-enable')) {
|
|
176
|
+
if (captions.classList.contains('d-none')) {
|
|
177
|
+
captions.classList.remove('d-none');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
169
180
|
}
|
|
170
|
-
subtitles(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
171
181
|
|
|
182
|
+
subtitlesHide(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
172
183
|
const playerContainer = instance.plyr.elements.container;
|
|
173
184
|
const playerControls = instance.plyr.elements.controls;
|
|
174
185
|
const captions = playerContainer.querySelector('.plyr__captions');
|
|
@@ -183,26 +194,43 @@ export namespace LTPlayerControlsEvents {
|
|
|
183
194
|
return;
|
|
184
195
|
}
|
|
185
196
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return;
|
|
197
|
+
if (playerControls.classList.contains('plyr__controls-enable')) {
|
|
198
|
+
if (!captions.classList.contains('d-none')) {
|
|
199
|
+
captions.classList.add('d-none');
|
|
200
|
+
}
|
|
191
201
|
}
|
|
192
|
-
|
|
193
|
-
// captions.classList.add('on-controls-hover');
|
|
202
|
+
|
|
194
203
|
|
|
195
204
|
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export class Desktop {
|
|
208
|
+
|
|
209
|
+
common: Common
|
|
210
|
+
constructor() {
|
|
211
|
+
this.common = new Common();
|
|
212
|
+
}
|
|
213
|
+
titleLineBreak(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
214
|
+
this.common.checkTitleBreakWord(instance)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
196
218
|
showHide(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
|
|
197
219
|
const controls = instance.plyr.elements.controls;
|
|
220
|
+
const eventsInstance = this;
|
|
221
|
+
|
|
198
222
|
controls.addEventListener('mouseover', function () {
|
|
199
|
-
controls.classList.add('plyr__controls-enable')
|
|
223
|
+
controls.classList.add('plyr__controls-enable');
|
|
224
|
+
eventsInstance.common.subtitlesHide(instance);
|
|
200
225
|
})
|
|
201
226
|
|
|
202
227
|
|
|
203
228
|
controls.addEventListener('mouseleave', function () {
|
|
204
229
|
if (!controls.classList.contains('plyr__controls-enable-settings')) {
|
|
205
|
-
controls.classList.remove('plyr__controls-enable')
|
|
230
|
+
controls.classList.remove('plyr__controls-enable');
|
|
231
|
+
setTimeout(()=>{
|
|
232
|
+
eventsInstance.common.subtitlesShow(instance);
|
|
233
|
+
}, 100)
|
|
206
234
|
}
|
|
207
235
|
})
|
|
208
236
|
}
|
|
@@ -370,45 +398,28 @@ export namespace LTPlayerControlsEvents {
|
|
|
370
398
|
|
|
371
399
|
const volume:HTMLElement = playerControlsContainer.querySelector('.bottom-controller__volume_control');
|
|
372
400
|
const openVolumeButton: HTMLElement = playerControlsContainer.querySelector('.volume_control__volume-button');
|
|
373
|
-
const
|
|
401
|
+
const muteUnmuteVolumeButton: HTMLElement = playerControlsContainer.querySelector('.volume_control__volume-button-close');
|
|
374
402
|
const volumeControl: HTMLElement = playerControlsContainer.querySelector('.volume_control__background__area');
|
|
375
403
|
const volumeBackground: HTMLElement = playerControlsContainer.querySelector('.volume_control__background');
|
|
376
404
|
const volumeRangeControl: HTMLElement = playerControlsContainer.querySelector('.volume_control__background__area__range');
|
|
405
|
+
const rangeVolumesItems: NodeListOf<HTMLElement>= volume.querySelectorAll('.volume-max, .volume-75, .volume-50, .volume-mute');
|
|
406
|
+
|
|
407
|
+
openVolumeButton.addEventListener('mouseover', (event) => {
|
|
408
|
+
volumeControl.classList.remove('d-none');
|
|
409
|
+
volumeBackground.classList.remove('d-none');
|
|
410
|
+
openVolumeButton.classList.add('d-none');
|
|
411
|
+
volume.classList.add('volume-control-enable');
|
|
412
|
+
volume.classList.add('volume-area-open')
|
|
413
|
+
})
|
|
377
414
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
if (!volume.classList.contains('volume-control-enable')) {
|
|
386
|
-
if (!eventTarget.classList.contains('button-open')) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (
|
|
392
|
-
!eventTarget.classList.contains('button-close') &&
|
|
393
|
-
!eventTarget.classList.contains('volume-area-open')
|
|
394
|
-
) {
|
|
395
|
-
if (!volume.classList.contains('volume-control-enable')) {
|
|
396
|
-
volumeControl.classList.remove('d-none');
|
|
397
|
-
volumeBackground.classList.remove('d-none');
|
|
398
|
-
openVolumeButton.classList.add('d-none');
|
|
399
|
-
volume.classList.add('volume-control-enable');
|
|
400
|
-
volume.classList.add('volume-area-open')
|
|
401
|
-
} else {
|
|
402
|
-
volumeControl.classList.add('d-none');
|
|
403
|
-
volumeBackground.classList.add('d-none');
|
|
404
|
-
openVolumeButton.classList.remove('d-none');
|
|
405
|
-
volume.classList.remove('volume-control-enable');
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
event.preventDefault();
|
|
415
|
+
volume.addEventListener('mouseleave', () => {
|
|
416
|
+
volumeControl.classList.add('d-none');
|
|
417
|
+
volumeBackground.classList.add('d-none');
|
|
418
|
+
openVolumeButton.classList.remove('d-none');
|
|
419
|
+
volume.classList.remove('volume-control-enable');
|
|
409
420
|
})
|
|
410
421
|
|
|
411
|
-
|
|
422
|
+
muteUnmuteVolumeButton.addEventListener('click', (event) => {
|
|
412
423
|
event.preventDefault();
|
|
413
424
|
if (instance.plyr.volume > 0) {
|
|
414
425
|
instance.playerControl.playerVolumeBefore = instance.plyr.volume;
|
|
@@ -433,12 +444,11 @@ export namespace LTPlayerControlsEvents {
|
|
|
433
444
|
range = range.toString()
|
|
434
445
|
}
|
|
435
446
|
|
|
436
|
-
const volumeMax: HTMLElement =
|
|
437
|
-
const volume75: HTMLElement =
|
|
438
|
-
const volume50: HTMLElement =
|
|
439
|
-
const volumeMute: HTMLElement =
|
|
447
|
+
const volumeMax: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-max');
|
|
448
|
+
const volume75: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-75');
|
|
449
|
+
const volume50: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-50');
|
|
450
|
+
const volumeMute: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-mute');
|
|
440
451
|
const volumeBody: HTMLElement = playerControlsContainer.querySelector('.bottom-controller__volume_control');
|
|
441
|
-
|
|
442
452
|
const volumeIconsManger = (item: HTMLElement) => {
|
|
443
453
|
|
|
444
454
|
const rangeVolumesItems: NodeListOf<HTMLElement>= volumeBody.querySelectorAll('.volume-max, .volume-75, .volume-50, .volume-mute');
|
|
@@ -469,7 +479,26 @@ export namespace LTPlayerControlsEvents {
|
|
|
469
479
|
}
|
|
470
480
|
|
|
471
481
|
volumeRangeControl.addEventListener('input', function () {
|
|
472
|
-
|
|
482
|
+
|
|
483
|
+
let itemsDataSet: string[] = [];
|
|
484
|
+
|
|
485
|
+
rangeVolumesItems.forEach(item => {
|
|
486
|
+
itemsDataSet.push(item.dataset.rangeValue)
|
|
487
|
+
})
|
|
488
|
+
|
|
489
|
+
if (itemsDataSet.length === 0) {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const getClosest = (curr: any, prev: any, range: any) => {
|
|
494
|
+
return (Math.abs(curr - range) < Math.abs(prev - range) ? curr : prev);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
let closest = itemsDataSet.reduce(function(prev, curr) {
|
|
499
|
+
return getClosest(curr, prev, (volumeRangeControl as HTMLInputElement).value);
|
|
500
|
+
});
|
|
501
|
+
volumeIcons(closest);
|
|
473
502
|
})
|
|
474
503
|
|
|
475
504
|
instance.plyr.volume = 1;
|
|
@@ -528,6 +557,8 @@ export namespace LTPlayerControlsEvents {
|
|
|
528
557
|
showControls(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
529
558
|
const playerContainer = instance.plyr.elements.container;
|
|
530
559
|
const playerControlsContainer = instance.plyr.elements.controls;
|
|
560
|
+
const eventsInstance = this;
|
|
561
|
+
|
|
531
562
|
let playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
|
|
532
563
|
|
|
533
564
|
if (playerContainer.classList.contains('plyr--hide-controls')) {
|
|
@@ -544,6 +575,8 @@ export namespace LTPlayerControlsEvents {
|
|
|
544
575
|
playerControlsContainer.classList.add('plyr__controls-enable');
|
|
545
576
|
}
|
|
546
577
|
|
|
578
|
+
eventsInstance.common.subtitlesHide(instance);
|
|
579
|
+
|
|
547
580
|
if (this.controlsTimeOut) {
|
|
548
581
|
clearTimeout(this.controlsTimeOut);
|
|
549
582
|
}
|
|
@@ -554,6 +587,7 @@ export namespace LTPlayerControlsEvents {
|
|
|
554
587
|
hideControls(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType, now: boolean) {
|
|
555
588
|
const playerContainer = instance.plyr.elements.container;
|
|
556
589
|
const playerControlsContainer = instance.plyr.elements.controls;
|
|
590
|
+
const eventsInstance = this;
|
|
557
591
|
let playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
|
|
558
592
|
|
|
559
593
|
if (!playerControlsContainer.classList.contains('plyr__controls-enable-addInfo')) {
|
|
@@ -573,6 +607,7 @@ export namespace LTPlayerControlsEvents {
|
|
|
573
607
|
}
|
|
574
608
|
}, 4000);
|
|
575
609
|
}
|
|
610
|
+
eventsInstance.common.subtitlesShow(instance);
|
|
576
611
|
}
|
|
577
612
|
}
|
|
578
613
|
|
|
@@ -146,10 +146,6 @@ export class LTPlayerCommon {
|
|
|
146
146
|
if (this.player.playerControl.chaptersService) {
|
|
147
147
|
this.player.playerControl.chaptersService.updateCurrentTimeAndTitle(this.player, event);
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
//set captions
|
|
151
|
-
// TODO: Find a way to show/hide subtitles that does not loop on every timeUpdate. Consider using the controls show/hide event.
|
|
152
|
-
this.player.playerControl.desktopEvents.subtitles(this.player);
|
|
153
149
|
}
|
|
154
150
|
|
|
155
151
|
|
|
@@ -65,7 +65,7 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
65
65
|
}
|
|
66
66
|
eventManager.onReadyPlayer();
|
|
67
67
|
eventManager.modal(instance);
|
|
68
|
-
instance.posterManager.desktopEvents.
|
|
68
|
+
instance.posterManager.desktopEvents.posterBody(instance);
|
|
69
69
|
|
|
70
70
|
if (instance.playerConfig.getPreload()) {
|
|
71
71
|
eventManager.preloadPoster.ready(instance);
|
|
@@ -103,7 +103,7 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
103
103
|
window.addEventListener('click', function LTPLayerWindowClick(event: MouseEvent) {
|
|
104
104
|
|
|
105
105
|
if (instance.additionalInfoService) {
|
|
106
|
-
instance.additionalInfoService.desktopEvents.windowDesktopEvents(event);
|
|
106
|
+
instance.additionalInfoService.desktopEvents.windowDesktopEvents(event, instance);
|
|
107
107
|
}
|
|
108
108
|
LTPlayerSettingsControlsManager.closeSettingsEvent(event);
|
|
109
109
|
})
|
|
@@ -118,7 +118,7 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
118
118
|
plyr.embed.ready().then (function LTPlayerEmbedReady() {
|
|
119
119
|
eventManager.modal(instance);
|
|
120
120
|
eventManager.onReadyPlayer();
|
|
121
|
-
instance.posterManager.desktopEvents.
|
|
121
|
+
instance.posterManager.desktopEvents.posterBody(instance);
|
|
122
122
|
if (instance.playerConfig.getPreload()) {
|
|
123
123
|
eventManager.preloadPoster.ready(instance);
|
|
124
124
|
}
|
|
@@ -61,7 +61,7 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
eventManager.onReadyPlayer();
|
|
64
|
-
instance.posterManager.mobileEvents.
|
|
64
|
+
instance.posterManager.mobileEvents.posterBody(instance);
|
|
65
65
|
|
|
66
66
|
instance.playerControl.mobileEvents.seekBar(instance);
|
|
67
67
|
|
|
@@ -102,11 +102,11 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
102
102
|
let plyr: Plyr = this.plyr;
|
|
103
103
|
|
|
104
104
|
if (plyr.isEmbed) {
|
|
105
|
-
plyr.on('ready', function LTPLayerMobileReadyEmbed() {
|
|
106
|
-
plyr.embed.ready().then(function LTPlayerEmbedReady() {
|
|
105
|
+
plyr.on('ready', function LTPLayerMobileReadyEmbed(): void {
|
|
106
|
+
plyr.embed.ready().then(function LTPlayerEmbedReady():void {
|
|
107
107
|
eventManager.onReadyPlayer();
|
|
108
108
|
instance.playerControl.mobileEvents.seekBar(instance);
|
|
109
|
-
instance.posterManager.mobileEvents.
|
|
109
|
+
instance.posterManager.mobileEvents.posterBody(instance);
|
|
110
110
|
if (instance.playerConfig.getPreload()) {
|
|
111
111
|
eventManager.preloadPoster.ready(instance);
|
|
112
112
|
}
|
|
@@ -185,15 +185,13 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
185
185
|
|
|
186
186
|
//check if getDevice is mobile or desktop
|
|
187
187
|
if (instance.player.playerConfig.getDevice() === 'mobile') {
|
|
188
|
-
|
|
189
188
|
const manager = new Hammer.Manager(selector);
|
|
190
|
-
|
|
191
189
|
manager.add(new Hammer.Pan({
|
|
192
190
|
direction : 30
|
|
193
191
|
}))
|
|
194
192
|
|
|
195
193
|
manager.add(new Hammer.Tap({
|
|
196
|
-
event : '
|
|
194
|
+
event : 'tripletap',
|
|
197
195
|
taps : 3
|
|
198
196
|
}));
|
|
199
197
|
|
|
@@ -208,9 +206,9 @@ export class LTPlayerMobile extends LTPlayerCommon implements EventsInterfaces {
|
|
|
208
206
|
|
|
209
207
|
manager.get('doubletap').recognizeWith('singletap');
|
|
210
208
|
manager.get('singletap').requireFailure('doubletap');
|
|
211
|
-
manager.get('
|
|
212
|
-
manager.get('doubletap').requireFailure('
|
|
213
|
-
manager.get('pan').set({direction: Hammer.DIRECTION_DOWN})
|
|
209
|
+
manager.get('tripletap').recognizeWith('doubletap');
|
|
210
|
+
manager.get('doubletap').requireFailure('tripletap');
|
|
211
|
+
manager.get('pan').set({direction: Hammer.DIRECTION_DOWN});
|
|
214
212
|
|
|
215
213
|
return manager;
|
|
216
214
|
}
|
|
@@ -2,6 +2,7 @@ import {TemplateService} from "../../services/TemplateService";
|
|
|
2
2
|
import {LTPlayerConfig} from "../config/LTPlayerConfig";
|
|
3
3
|
import {IconsService} from "../../services/IconsService";
|
|
4
4
|
import Plyr from "plyr";
|
|
5
|
+
import {Helper} from "../../services/Helper";
|
|
5
6
|
|
|
6
7
|
export class LTPlayerPoster {
|
|
7
8
|
custom_selector: string = 'lt-player__poster';
|
|
@@ -22,7 +23,11 @@ export class LTPlayerPoster {
|
|
|
22
23
|
|
|
23
24
|
const logo: string = this.iconService.getLogo();
|
|
24
25
|
|
|
25
|
-
const
|
|
26
|
+
const playerTypeString = Helper.getPlayerStringType(this.config.getPlayerType());
|
|
27
|
+
|
|
28
|
+
let templateData = {[playerTypeString]: true, config:this.config, logoBig: logo, isShare : !!(this.config.isShareData())}
|
|
29
|
+
|
|
30
|
+
const posterTemplate = this.templateService.getPoster(templateData);
|
|
26
31
|
|
|
27
32
|
const container = this.plyr.elements.wrapper;
|
|
28
33
|
|