@latest-thinking/lt-player 1.0.4-q → 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 -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/controllers/_mini-player.scss +36 -2
- package/src/components/LTPlayerDevMethode.ts +23 -3
- package/src/components/LTPlayerType.ts +47 -4
- package/src/components/config/LTPlayerConfig.ts +8 -0
- package/src/components/controls/LTPlayerControlsEvents.ts +19 -6
- package/src/components/controls/LTPlayerMini.ts +45 -3
- package/src/components/events/LTPlayer.ts +10 -1
- package/src/components/events/LTPlayerDesktop.ts +1 -1
- package/src/components/poster/LTPlayerPosterEvents.ts +3 -0
- package/src/views/background.handlebars +1 -1
package/package.json
CHANGED
|
@@ -3,11 +3,35 @@
|
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
5
5
|
}
|
|
6
|
+
|
|
7
|
+
@media (min-width: 266px) {
|
|
8
|
+
.lt-player-mini-player-observe {
|
|
9
|
+
height: 150px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
@media (min-width: 533px) {
|
|
13
|
+
.lt-player-mini-player-observe {
|
|
14
|
+
height: 200px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
@media (min-width: 800px) {
|
|
18
|
+
.lt-player-mini-player-observe {
|
|
19
|
+
height: 400px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
@media (min-width: 1067px) {
|
|
23
|
+
.lt-player-mini-player-observe {
|
|
24
|
+
height: 600px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
.lt-player-mini-enable {
|
|
7
33
|
position: fixed;
|
|
8
34
|
z-index: 10000;
|
|
9
|
-
max-width: 160px;
|
|
10
|
-
max-height: 290px;
|
|
11
35
|
bottom: 20px;
|
|
12
36
|
right: 20px;
|
|
13
37
|
opacity: 1;
|
|
@@ -19,6 +43,16 @@
|
|
|
19
43
|
}
|
|
20
44
|
}
|
|
21
45
|
|
|
46
|
+
.lt-player-mini-2 {
|
|
47
|
+
max-width: 344px;
|
|
48
|
+
max-height: 194px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.lt-player-mini-1 {
|
|
52
|
+
max-width: 160px;
|
|
53
|
+
max-height: 290px;
|
|
54
|
+
}
|
|
55
|
+
|
|
22
56
|
.lt-player-mini-player-background {
|
|
23
57
|
z-index: 100;
|
|
24
58
|
|
|
@@ -8,9 +8,11 @@ export namespace LTPlayerDevMethode {
|
|
|
8
8
|
export class Player {
|
|
9
9
|
|
|
10
10
|
player: Plyr
|
|
11
|
+
instance : LTPlayer.PortraitType | LTPlayer.LandscapeType
|
|
11
12
|
|
|
12
|
-
constructor(
|
|
13
|
-
this.player =
|
|
13
|
+
constructor(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
|
|
14
|
+
this.player = instance.plyr;
|
|
15
|
+
this.instance = instance
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
play() {
|
|
@@ -77,7 +79,9 @@ export namespace LTPlayerDevMethode {
|
|
|
77
79
|
let miniPlayer = {
|
|
78
80
|
controls : playerContainer.querySelector('.lt-player-mini-player-controls'),
|
|
79
81
|
background: playerContainer.querySelector('.lt-player-mini-player-background'),
|
|
80
|
-
enable: playerContainer.querySelector('.lt-player-mini-enable')
|
|
82
|
+
enable: playerContainer.querySelector('.lt-player-mini-enable'),
|
|
83
|
+
size_land: playerContainer.querySelector(`.lt-player-mini-1`),
|
|
84
|
+
size_port: playerContainer.querySelector(`.lt-player-mini-2`)
|
|
81
85
|
};
|
|
82
86
|
|
|
83
87
|
if (miniPlayer.controls) {
|
|
@@ -88,6 +92,14 @@ export namespace LTPlayerDevMethode {
|
|
|
88
92
|
miniPlayer.background.remove();
|
|
89
93
|
}
|
|
90
94
|
|
|
95
|
+
if (miniPlayer.size_land) {
|
|
96
|
+
miniPlayer.size_land.classList.remove(`lt-player-mini-1`)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (miniPlayer.size_port) {
|
|
100
|
+
miniPlayer.size_port.classList.remove(`lt-player-mini-2`)
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
if (miniPlayer.enable) {
|
|
92
104
|
miniPlayer.enable.classList.remove('lt-player-mini-enable')
|
|
93
105
|
}
|
|
@@ -106,6 +118,14 @@ export namespace LTPlayerDevMethode {
|
|
|
106
118
|
exitFullScreen();
|
|
107
119
|
|
|
108
120
|
}
|
|
121
|
+
|
|
122
|
+
enterMiniPlayer() {
|
|
123
|
+
this.instance.miniPlayer.enterMiniPlayer();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
exitMiniPlayer() {
|
|
127
|
+
this.instance.miniPlayer.exitMiniPlayer(this.player);
|
|
128
|
+
}
|
|
109
129
|
}
|
|
110
130
|
|
|
111
131
|
export class Preload {
|
|
@@ -138,7 +138,7 @@ export namespace LTPlayer {
|
|
|
138
138
|
|
|
139
139
|
this.plyr = player;
|
|
140
140
|
|
|
141
|
-
this.devMethodePlayer = new LTPlayerDevMethode.Player(
|
|
141
|
+
this.devMethodePlayer = new LTPlayerDevMethode.Player(this);
|
|
142
142
|
|
|
143
143
|
this.posterManager.init(this);
|
|
144
144
|
|
|
@@ -147,7 +147,7 @@ export namespace LTPlayer {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
if (this.playerConfig.getDevice() !== 'mobile') {
|
|
150
|
-
this.miniPlayer.init(player, this.templateService, this.iconService);
|
|
150
|
+
this.miniPlayer.init(player, this.templateService, this.iconService, this.playerConfig.getPlayerType(), this);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -167,6 +167,13 @@ export namespace LTPlayer {
|
|
|
167
167
|
return this.devMethodePreload;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
enterMiniPlayer() {
|
|
171
|
+
return this.devMethodePlayer.enterMiniPlayer()
|
|
172
|
+
}
|
|
173
|
+
exitMiniPlayer() {
|
|
174
|
+
return this.devMethodePlayer.exitMiniPlayer()
|
|
175
|
+
}
|
|
176
|
+
|
|
170
177
|
destruct() {
|
|
171
178
|
let _this = this;
|
|
172
179
|
|
|
@@ -257,7 +264,7 @@ export namespace LTPlayer {
|
|
|
257
264
|
|
|
258
265
|
this.plyr = player;
|
|
259
266
|
|
|
260
|
-
this.devMethodePlayer = new LTPlayerDevMethode.Player(
|
|
267
|
+
this.devMethodePlayer = new LTPlayerDevMethode.Player(this);
|
|
261
268
|
|
|
262
269
|
this.posterManager.init(this);
|
|
263
270
|
|
|
@@ -266,7 +273,7 @@ export namespace LTPlayer {
|
|
|
266
273
|
}
|
|
267
274
|
|
|
268
275
|
if (this.playerConfig.getDevice() !== 'mobile') {
|
|
269
|
-
this.miniPlayer.init(player, this.templateService, this.iconService);
|
|
276
|
+
this.miniPlayer.init(player, this.templateService, this.iconService, this.playerConfig.getPlayerType(), this);
|
|
270
277
|
}
|
|
271
278
|
}
|
|
272
279
|
|
|
@@ -295,7 +302,43 @@ export namespace LTPlayer {
|
|
|
295
302
|
return this.plyr;
|
|
296
303
|
}
|
|
297
304
|
|
|
305
|
+
play() {
|
|
306
|
+
this.devMethodePlayer.play();
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
pause() {
|
|
310
|
+
this.devMethodePlayer.pause();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
stop() {
|
|
314
|
+
this.devMethodePlayer.stop();
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
preload() {
|
|
318
|
+
return this.devMethodePreload;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
enterMiniPlayer() {
|
|
322
|
+
return this.devMethodePlayer.enterMiniPlayer()
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
exitMiniPlayer() {
|
|
326
|
+
return this.devMethodePlayer.exitMiniPlayer()
|
|
327
|
+
}
|
|
328
|
+
|
|
298
329
|
destruct() {
|
|
330
|
+
let _this = this;
|
|
331
|
+
|
|
332
|
+
return new Promise((resolve) => {
|
|
333
|
+
_this.additionalInfoService.remove(this);
|
|
334
|
+
|
|
335
|
+
_this.additionalInfoService = null;
|
|
336
|
+
|
|
337
|
+
this.plyr.destroy(() => {
|
|
338
|
+
_this = undefined;
|
|
339
|
+
resolve(true);
|
|
340
|
+
})
|
|
341
|
+
})
|
|
299
342
|
}
|
|
300
343
|
setDesktopEvents() {
|
|
301
344
|
this.desktopEvents = new LTPlayerEvents.Desktop();
|
|
@@ -78,6 +78,14 @@ export class LTPlayerConfig {
|
|
|
78
78
|
return this.configData.observe
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
isObserveHeight() {
|
|
82
|
+
return this.configData.observe.height;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
isObserveWidth() {
|
|
86
|
+
return this.configData.observe.width;
|
|
87
|
+
}
|
|
88
|
+
|
|
81
89
|
getDimensions() {
|
|
82
90
|
return this.configData.dimensions
|
|
83
91
|
}
|
|
@@ -134,14 +134,27 @@ export namespace LTPlayerControlsEvents {
|
|
|
134
134
|
const playIcon = playerContainer.querySelector('.bottom-controller__play-icon');
|
|
135
135
|
const pauseIcon = playerContainer.querySelector('.bottom-controller__pause-icon');
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
+
})
|
|
141
147
|
} else {
|
|
142
|
-
|
|
143
|
-
|
|
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
|
+
}
|
|
144
155
|
}
|
|
156
|
+
|
|
157
|
+
|
|
145
158
|
}
|
|
146
159
|
}
|
|
147
160
|
|
|
@@ -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
|
|
|
@@ -27,10 +27,14 @@ export namespace LTPlayerEvents {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const miniPlayerEnable = playerContainer.querySelector('.lt-player-mini-enable');
|
|
30
|
+
const miniPlayerEnableSize = playerContainer.querySelector(`.lt-player-mini-${player.playerConfig.getPlayerType()}`);
|
|
30
31
|
|
|
31
32
|
if (miniPlayerEnable) {
|
|
32
33
|
miniPlayerEnable.classList.remove('lt-player-mini-enable');
|
|
33
34
|
}
|
|
35
|
+
if (miniPlayerEnableSize) {
|
|
36
|
+
miniPlayerEnableSize.classList.remove(`.lt-player-mini-${player.playerConfig.getPlayerType()}`);
|
|
37
|
+
}
|
|
34
38
|
|
|
35
39
|
})
|
|
36
40
|
|
|
@@ -134,7 +138,8 @@ export namespace LTPlayerEvents {
|
|
|
134
138
|
let miniPlayer = {
|
|
135
139
|
controls : playerContainer.querySelector('.lt-player-mini-player-controls'),
|
|
136
140
|
background: playerContainer.querySelector('.lt-player-mini-player-background'),
|
|
137
|
-
enable: playerContainer.querySelector('.lt-player-mini-enable')
|
|
141
|
+
enable: playerContainer.querySelector('.lt-player-mini-enable'),
|
|
142
|
+
size: playerContainer.querySelector(`.lt-player-mini-${instance.playerConfig.getPlayerType()}`)
|
|
138
143
|
};
|
|
139
144
|
|
|
140
145
|
if (miniPlayer.controls) {
|
|
@@ -145,6 +150,10 @@ export namespace LTPlayerEvents {
|
|
|
145
150
|
miniPlayer.background.remove();
|
|
146
151
|
}
|
|
147
152
|
|
|
153
|
+
if (miniPlayer.size) {
|
|
154
|
+
miniPlayer.size.classList.remove(`lt-player-mini-${instance.playerConfig.getPlayerType()}`)
|
|
155
|
+
}
|
|
156
|
+
|
|
148
157
|
if (miniPlayer.enable) {
|
|
149
158
|
miniPlayer.enable.classList.remove('lt-player-mini-enable')
|
|
150
159
|
}
|
|
@@ -147,8 +147,8 @@ export class LTPlayerDesktop extends LTPlayerCommon implements EventsInterfaces
|
|
|
147
147
|
common.timeUpdate(event);
|
|
148
148
|
if (instance.playerConfig.getPreload().isActive) {
|
|
149
149
|
common.preloadPoster.timeUpdate(instance, 'event');
|
|
150
|
-
instance.playerControl.desktopEvents.playPauseIcon(instance, 'timeupdate');
|
|
151
150
|
}
|
|
151
|
+
instance.playerControl.desktopEvents.playPauseIcon(instance, 'timeupdate');
|
|
152
152
|
})
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -88,6 +88,7 @@ export namespace LTPlayerPosterEvents {
|
|
|
88
88
|
button.addEventListener('click', function LTPlayerPosterButtons(event) {
|
|
89
89
|
event.preventDefault();
|
|
90
90
|
instance.playerControl.desktopEvents.titleLineBreak(instance);
|
|
91
|
+
instance.playerControl.desktopEvents.playPauseIcon(instance, 'timeupdate');
|
|
91
92
|
common.poster.reset(instance);
|
|
92
93
|
})
|
|
93
94
|
});
|
|
@@ -109,8 +110,10 @@ export namespace LTPlayerPosterEvents {
|
|
|
109
110
|
|
|
110
111
|
if (mobileEvent) {
|
|
111
112
|
mobileEvent.on('singletap', function LTPlayerMobilePosterButtons() {
|
|
113
|
+
|
|
112
114
|
instance.playerControl.desktopEvents.titleLineBreak(instance);
|
|
113
115
|
|
|
116
|
+
instance.playerControl.mobileEvents.playPauseIcon(instance, 'timeupdate');
|
|
114
117
|
common.poster.reset(instance);
|
|
115
118
|
|
|
116
119
|
playerContainer.classList.remove('plyr__poster-enabled');
|