@latest-thinking/lt-player 1.0.5-l → 1.0.5-n

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.
@@ -1,7 +1,3 @@
1
- body {
2
- margin: 0 !important;
3
- }
4
-
5
1
  @import "../../abstracts/variables";
6
2
 
7
3
  .lt-player-landscape--desktop,
@@ -10,10 +6,10 @@ body {
10
6
  &__controls {
11
7
  .bottom-controller {
12
8
  max-width: 100%;
13
- padding: 2rem;
9
+ padding: 28px 40px;
14
10
 
15
11
  .play-button {
16
- padding: 1rem;
12
+ padding: 16px;
17
13
  bottom: -5px;
18
14
  }
19
15
 
@@ -46,7 +42,7 @@ body {
46
42
  &__previous-chapter-view-wrapper,
47
43
  &__next-chapter-view-wrapper {
48
44
  display: flex;
49
- gap: 1rem;
45
+ gap: 16px;
50
46
  align-items: flex-end;
51
47
  }
52
48
 
@@ -62,8 +58,9 @@ body {
62
58
  &__previous-chapter-view {
63
59
  display: flex;
64
60
  align-items: flex-end;
65
- margin-bottom: .4rem;
61
+ margin-bottom: 4px;
66
62
  width: 100px;
63
+ font-size: $lt-player-font-size-lg;
67
64
  color: $default-lt-player-white !important;
68
65
  }
69
66
 
@@ -79,19 +76,26 @@ body {
79
76
  }
80
77
 
81
78
  &.lt-player--landscape {
82
- &__md {
79
+ &__lg {
83
80
  .plyr {
84
81
  &__controls {
85
82
  .bottom-controller {
86
- .play-button {
87
- //padding: .75rem;
88
- //bottom: -2px;
83
+ &__previous-chapter-view {
84
+ display: none;
89
85
  }
90
86
 
91
- &__center-buttons {
92
- //gap: 1rem;
87
+ &__next-chapter-view {
88
+ display: none;
93
89
  }
90
+ }
91
+ }
92
+ }
93
+ }
94
94
 
95
+ &__md {
96
+ .plyr {
97
+ &__controls {
98
+ .bottom-controller {
95
99
  &__previous-chapter-view {
96
100
  display: none;
97
101
  }
@@ -108,13 +112,8 @@ body {
108
112
  .plyr {
109
113
  &__controls {
110
114
  .bottom-controller {
111
- .play-button {
112
- padding: .75rem;
113
- bottom: -2px;
114
- }
115
-
116
115
  &__center-buttons {
117
- gap: 1rem;
116
+ gap: 20px;
118
117
  }
119
118
 
120
119
  &__previous-chapter-view {
@@ -138,17 +137,55 @@ body {
138
137
  .plyr {
139
138
  &__controls {
140
139
  .bottom-controller {
141
- padding: 1.5rem;
140
+ .plyr__controls_speed-button {
141
+ width: 32px;
142
+ height: 32px;
143
+ font-size: 10px;
144
+ transition: none;
145
+ }
146
+
147
+ &__left-buttons,
148
+ &__center-buttons,
149
+ &__right-buttons {
150
+ gap: 20px;
151
+ }
142
152
 
153
+ &__previous-chapter-view {
154
+ display: none;
155
+ }
156
+
157
+ &__next-chapter-view {
158
+ display: none;
159
+ }
160
+
161
+ .skip-backward-seconds,
162
+ .skip-forward-seconds {
163
+ display: none;
164
+ }
165
+ }
166
+ }
167
+ }
168
+ }
169
+
170
+ &__xxs {
171
+ .plyr {
172
+ &__progress {
173
+ &--wrapper {
174
+ bottom: 70px;
175
+ }
176
+ }
177
+
178
+ &__controls {
179
+ .bottom-controller {
143
180
  .play-button {
144
- padding: .75rem;
181
+ padding: 12px;
145
182
  bottom: -2px;
146
183
  }
147
184
 
148
185
  .plyr__controls_speed-button {
149
186
  width: 32px;
150
187
  height: 32px;
151
- font-size: .6rem;
188
+ font-size: 10px;
152
189
  transition: none;
153
190
  }
154
191
 
@@ -159,7 +196,7 @@ body {
159
196
  &__left-buttons,
160
197
  &__center-buttons,
161
198
  &__right-buttons {
162
- gap: .5rem;
199
+ gap: 16px;
163
200
  }
164
201
 
165
202
  &__previous-chapter-view {
@@ -199,25 +236,36 @@ body {
199
236
 
200
237
  .lt-player-portrate--mobile,
201
238
  .lt-player-portrate--desktop {
239
+ .plyr {
240
+ &__progress {
241
+ &--wrapper {
242
+ width: 100%;
243
+ padding: 0 25px;
244
+ position: absolute;
245
+ bottom: 90px;
246
+ }
247
+ }
248
+ }
249
+
202
250
  &.lt-player--portrait {
203
251
  &__xs {
204
252
  .plyr {
205
253
  &__controls {
206
254
  .bottom-controller {
207
- padding: 1rem;
255
+ padding: 16px;
208
256
 
209
257
  button {
210
258
  @include buttons-xs;
211
259
  }
212
260
 
213
261
  .play-button {
214
- padding: .75rem;
262
+ padding: 12px;
215
263
  }
216
264
 
217
265
  .plyr__controls_speed-button {
218
266
  width: 32px;
219
267
  height: 32px;
220
- font-size: .6rem;
268
+ font-size: 10px;
221
269
  transition: none;
222
270
  }
223
271
  }
@@ -233,9 +281,9 @@ body {
233
281
 
234
282
  &--wrapper {
235
283
  width: 100%;
236
- padding: 0 2rem;
284
+ padding: 0 40px;
237
285
  position: absolute;
238
- bottom: 6rem;
286
+ bottom: 90px;
239
287
  }
240
288
  }
241
289
 
@@ -249,7 +297,7 @@ body {
249
297
  display: flex;
250
298
  justify-content: space-between;
251
299
  align-items: flex-end;
252
- padding: 1.5rem;
300
+ padding: 24px;
253
301
 
254
302
  button {
255
303
  @extend %lt-player-btn;
@@ -295,15 +343,15 @@ body {
295
343
  .play-button {
296
344
  @extend %lt-player-btn;
297
345
  @include yellow-btn;
298
- padding: 1rem;
346
+ padding: 16px;
299
347
  }
300
348
  }
301
349
 
302
350
  &__current {
303
351
  display: flex;
304
352
  justify-content: space-between;
305
- margin-left: -0.5rem;
306
- margin-right: -0.5rem;
353
+ margin-left: -8px;
354
+ margin-right: -8px;
307
355
 
308
356
  .plyr {
309
357
  &__time {
@@ -327,14 +375,14 @@ body {
327
375
  &__area {
328
376
  position: absolute;
329
377
  rotate: 270deg!important;
330
- bottom: 5rem;
378
+ bottom: 80px;
331
379
  max-width: 110px;
332
380
  min-width: 80px;
333
381
  width: 20%;
334
382
 
335
383
  .volume_control__background__area__range {
336
384
  color: $default-lt-button-color !important;
337
- min-width: 8rem;
385
+ min-width: 128px;
338
386
  -webkit-appearance: none;
339
387
  appearance: none;
340
388
  background: transparent;
@@ -381,7 +429,7 @@ body {
381
429
  }
382
430
 
383
431
  .volume_control__volume-button-close {
384
- bottom: 5rem;
432
+ bottom: 80px;
385
433
  background: $default-lt-player-white;
386
434
  display: flex;
387
435
  justify-content: center;
@@ -403,7 +451,7 @@ body {
403
451
  &__background {
404
452
  position: absolute;
405
453
  width: 100%;
406
- height: 10rem;
454
+ height: 160px;
407
455
  bottom: 0;
408
456
  right: 0;
409
457
  background: linear-gradient(transparent,rgba(0,0,0,.75))!important;
@@ -78,7 +78,7 @@
78
78
  &__play-button {
79
79
  @extend %lt-player-btn;
80
80
  @include yellow-btn;
81
- padding: .75rem;
81
+ padding: 12px;
82
82
  }
83
83
 
84
84
  &__progress__seek {
@@ -3,19 +3,18 @@
3
3
  &__xs {
4
4
  .lt-player-notification {
5
5
  .lt-player-video-content {
6
- padding: 0 1rem;
6
+ padding: 0 16px;
7
7
 
8
8
  .poster-title {
9
9
  @extend %line-clamp-3;
10
10
  @include line-clamp-3;
11
- font-size: .8rem;
11
+ font-size: $lt-player-font-size-xs;
12
12
  }
13
13
 
14
14
  .poster-paragraph {
15
15
  &__content {
16
- font-size: .9rem;
16
+ font-size: 14px;
17
17
  }
18
-
19
18
  }
20
19
  }
21
20
  }
@@ -25,7 +24,7 @@
25
24
  .lt-player-notification {
26
25
  .lt-player-video-content {
27
26
  .poster-title {
28
- font-size: 1rem;
27
+ font-size: $lt-player-font-size-base;
29
28
  }
30
29
  }
31
30
  }
@@ -55,7 +54,7 @@
55
54
  @extend %lt-player-btn;
56
55
  @include dark-btn;
57
56
  background: rgba(39, 40, 42, 0.5);
58
- padding: 1rem;
57
+ padding: 16px;
59
58
  }
60
59
 
61
60
  .active {
@@ -66,10 +65,10 @@
66
65
 
67
66
  .lt-player-video-content {
68
67
  position: absolute;
69
- bottom: 11rem;
68
+ bottom: 176px;
70
69
  text-align: left;
71
70
  display: flex;
72
- padding: 0 1.5rem;
71
+ padding: 0 24px;
73
72
  width: 100%;
74
73
  user-select: none;
75
74
  align-items: end;
@@ -83,7 +82,7 @@
83
82
  @extend %line-clamp-3;
84
83
  @include line-clamp-4;
85
84
  color: $default-lt-player-white !important;
86
- font-size: 1.313rem;
85
+ font-size: $lt-player-font-size-xxl;
87
86
  font-weight: $lt-player-font-weight-lg;
88
87
  line-height: $lt-player-line-height;
89
88
  margin: 0;
@@ -97,11 +96,11 @@
97
96
  word-wrap: break-word;
98
97
  text-overflow: ellipsis;
99
98
  overflow: hidden;
100
-
99
+ font-size: $lt-player-font-size-base;
101
100
  font-weight: $lt-player-font-weight-sm;
102
101
  color: $default-lt-player-white !important;
103
102
  margin-bottom: 0;
104
- max-height: 3.1rem;
103
+ max-height: 50px;
105
104
  transition: max-height 0.3s ease-in-out;
106
105
  }
107
106
 
@@ -119,12 +118,12 @@
119
118
  border: none;
120
119
  margin: 0;
121
120
  text-decoration: none;
122
- font-size: 0.8rem;
121
+ font-size: $lt-player-font-size-xs;
123
122
  color: white;
124
123
  cursor: pointer;
125
124
  position: absolute;
126
- bottom: 9rem;
127
- right: 6rem;
125
+ bottom: 144px;
126
+ right: 96px;
128
127
  z-index: 8;
129
128
  }
130
129
 
@@ -149,7 +148,7 @@
149
148
 
150
149
  &__icon-wrapper {
151
150
  display: flex;
152
- padding: 0 .5rem;
151
+ padding: 0 8px;
153
152
  user-select: none;
154
153
 
155
154
  &.rotate {
@@ -170,7 +169,7 @@
170
169
  }
171
170
 
172
171
  span {
173
- font-size: 12px;
172
+ font-size: $lt-player-font-size-xs;
174
173
  user-select: none;
175
174
  }
176
175
  }
@@ -182,11 +181,11 @@
182
181
  flex-direction: row-reverse;
183
182
 
184
183
  &__portrait {
185
- margin: auto auto auto 3rem;
184
+ margin: auto auto auto 48px;
186
185
  }
187
186
 
188
187
  &__landscape {
189
- margin: auto auto auto 4rem;
188
+ margin: auto auto auto 64px;
190
189
  }
191
190
  }
192
191
  }
@@ -196,11 +195,11 @@
196
195
 
197
196
  &__icon {
198
197
  &__portrait {
199
- margin: auto 3rem auto auto;
198
+ margin: auto 48px auto auto;
200
199
  }
201
200
 
202
201
  &__landscape {
203
- margin: auto 4rem auto auto;
202
+ margin: auto 64px auto auto;
204
203
  }
205
204
  }
206
205
  }
@@ -6,7 +6,11 @@
6
6
  &__controls-enable,
7
7
  &__controls-enable-settings {
8
8
  .top-controllers {
9
- padding: 2rem 2rem 0 2rem;
9
+ padding: 40px 40px 0;
10
+
11
+ &__background {
12
+ display: none;
13
+ }
10
14
  }
11
15
  }
12
16
  }
@@ -19,7 +23,7 @@
19
23
  .plyr {
20
24
  &__controls {
21
25
  .top-controllers {
22
- padding: 1rem;
26
+ padding: 16px;
23
27
 
24
28
  button {
25
29
  @include buttons-xs;
@@ -44,7 +48,7 @@
44
48
  &__controls-enable-settings {
45
49
  .top-controllers {
46
50
  width: 100%;
47
- padding: 1.5rem 1.5rem 0 1.5rem;
51
+ padding: 24px 24px 0 24px;
48
52
  position: absolute;
49
53
 
50
54
  button {
@@ -103,7 +107,7 @@
103
107
  &__right {
104
108
 
105
109
  .mini-player-control {
106
- margin-top: 1rem;
110
+ margin-top: 16px;
107
111
  }
108
112
  }
109
113
  }
@@ -201,12 +201,8 @@ export class LTPlayerSetup {
201
201
  return processVideo();
202
202
 
203
203
  }
204
-
205
204
  }
206
205
 
207
-
208
-
209
-
210
206
  /**
211
207
  * Set Additional Info
212
208
  * @param playerConfig
@@ -215,15 +211,24 @@ export class LTPlayerSetup {
215
211
 
216
212
  const additionalInfoContainer:HTMLElement = playerConfig.body.playerContainer.querySelector('.lt-player-additional-info');
217
213
 
218
- if (!additionalInfoContainer) {
219
- this.additionalInfoService = null;
214
+ if (additionalInfoContainer) {
215
+ this.additionalInfoService = new LTPLayerAddInfo.Controller();
216
+ this.additionalInfoService.setContainer(additionalInfoContainer);
220
217
  return;
221
218
  }
222
219
 
223
- this.additionalInfoService = new LTPLayerAddInfo.Controller();
224
- this.additionalInfoService.set(additionalInfoContainer);
225
220
 
221
+ if (playerConfig.body.additionalInfo !== undefined && Object.keys(playerConfig.body.additionalInfo).length > 0) {
222
+ this.additionalInfoService = new LTPLayerAddInfo.Controller();
223
+ this.additionalInfoService.setConfig(playerConfig.body.additionalInfo);
224
+ return;
225
+ }
226
+
227
+
228
+ this.additionalInfoService = null;
226
229
  return;
230
+
231
+
227
232
  }
228
233
 
229
234
  /**
@@ -40,6 +40,11 @@ export namespace LTPlayer {
40
40
  this.miniPlayer = new LTPlayerMini();
41
41
  this.setPlayerConfig(configData.body, configData.version);
42
42
  this.initPlayer();
43
+
44
+ if (this.additionalInfoService) {
45
+ this.additionalInfoService.init(this, this.playerConfig.getPlayerId(), this.iconService, this.templateService)
46
+ }
47
+
43
48
  this.setEvents();
44
49
 
45
50
  return true;
@@ -42,7 +42,7 @@ export namespace LTPLayerAddInfo {
42
42
  export class Controller extends LTPlayerAddInfoManager {
43
43
  activePlayer: Plyr;
44
44
 
45
- set(container: HTMLElement) {
45
+ setContainer(container: HTMLElement) {
46
46
  this.container = container;
47
47
  this.setDataContent();
48
48
  }
@@ -61,6 +61,14 @@ export namespace LTPLayerAddInfo {
61
61
  })
62
62
  }
63
63
 
64
+ setConfig(config: defaultType) {
65
+ Object.keys(config).forEach(item => {
66
+ if (Object.keys(config[item]).length > 0) {
67
+ Object.assign(this.additionalData, {[item] : config[item]})
68
+ }
69
+ })
70
+ }
71
+
64
72
  init(player: LTPlayer.PortraitType | LTPlayer.LandscapeType, playerId: number, iconService: IconsService, templateService: TemplateService) {
65
73
 
66
74
  if (Object.keys(this.additionalData).length === 0) {
@@ -101,7 +109,6 @@ export namespace LTPLayerAddInfo {
101
109
 
102
110
  setCurrentPlayerPlay(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType, event: PlyrEvent) {
103
111
  this.activePlayer = event.detail.plyr;
104
- console.log(this.activePlayer.elements.container)
105
112
  }
106
113
  remove(instance: LTPlayer.LandscapeType | LTPlayer.PortraitType) {
107
114
 
@@ -132,7 +139,9 @@ export namespace LTPLayerAddInfo {
132
139
 
133
140
  switch (this.controller.device) {
134
141
  case 'mobile':
135
- this.mobile();
142
+ this.controller.plyr.on('ready', () => {
143
+ this.mobile();
144
+ })
136
145
  break
137
146
  case 'desktop':
138
147
  this.desktop();
@@ -176,7 +185,6 @@ export namespace LTPLayerAddInfo {
176
185
 
177
186
 
178
187
  desktop() {
179
- const playerContainer = this.controller.plyr.elements.container;
180
188
  const icons: defaultType = this.controller.iconService.getIconsByComponent('additionalInfo');
181
189
 
182
190
  let templateData: { target: string; icon: any; }[] = [];
@@ -204,7 +212,6 @@ export namespace LTPLayerAddInfo {
204
212
  exist: 'true',
205
213
  buttons: templateData
206
214
  });
207
-
208
215
  this.controller.playerInstance.windowService.setEventAddInfo(buttonsTemplate, this.desktopEvents, this.controller);
209
216
  }
210
217
  }
@@ -37,12 +37,25 @@ export namespace LTPlayerAdditionalInfo {
37
37
  }
38
38
 
39
39
  const createInformationModal = (info: additionalInformation, key: string) => {
40
- let modalTemplate = controller.templateService.getAdditionalInfo({
41
- desktop : true,
42
- modal : true,
43
- id : `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
44
- data : info
45
- })
40
+
41
+ let modalTemplate = null;
42
+
43
+ if (typeof info === 'object') {
44
+ modalTemplate = controller.templateService.getAdditionalInfo({
45
+ desktop : true,
46
+ modal : true,
47
+ id : `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
48
+ object_data : true,
49
+ [key] : info
50
+ })
51
+ } else {
52
+ modalTemplate = controller.templateService.getAdditionalInfo({
53
+ desktop : true,
54
+ modal : true,
55
+ id : `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
56
+ data : info
57
+ })
58
+ }
46
59
 
47
60
  document.querySelector('body').insertAdjacentHTML("afterend", modalTemplate);
48
61
  }
@@ -104,12 +117,24 @@ export namespace LTPlayerAdditionalInfo {
104
117
  }
105
118
 
106
119
  const createInformationModal = (info: additionalInformation, key: string) => {
107
- let modalTemplate = instance.templateService.getAdditionalInfo({
108
- mobile : true,
109
- modal : true,
110
- data : info,
111
- [controller.device] : true
112
- })
120
+ let modalTemplate = null;
121
+
122
+ if (typeof info === 'object') {
123
+ modalTemplate = controller.templateService.getAdditionalInfo({
124
+ mobile : true,
125
+ modal : true,
126
+ [controller.device] : true,
127
+ object_data : true,
128
+ [key] : info
129
+ })
130
+ } else {
131
+ modalTemplate = controller.templateService.getAdditionalInfo({
132
+ mobile : true,
133
+ modal : true,
134
+ data : info,
135
+ [controller.device] : true
136
+ })
137
+ }
113
138
 
114
139
  const playerControlsContainer = instance.plyr.elements.controls;
115
140
  const modal = playerControlsContainer.querySelector('.player-lt__modal__mobile');
@@ -207,10 +207,6 @@ export namespace LTPlayerConfigProcessor {
207
207
  return null
208
208
  }
209
209
 
210
- if (version === 1) {
211
- return null;
212
- }
213
-
214
210
  type shareDataConfig = {
215
211
  canonicalUrl : string,
216
212
  embedUrl : string,
@@ -223,6 +219,15 @@ export namespace LTPlayerConfigProcessor {
223
219
  title : undefined
224
220
  }
225
221
 
222
+ if (version === 1) {
223
+ data = {
224
+ canonicalUrl: data.canonical_url ?? null,
225
+ embedUrl: `${window.location.origin}/embed/${data.id}`,
226
+ title: data.title ?? null,
227
+ };
228
+ }
229
+
230
+
226
231
  if (Object.keys(data).length === 0) {
227
232
  return;
228
233
  }
@@ -240,7 +245,6 @@ export namespace LTPlayerConfigProcessor {
240
245
  }
241
246
 
242
247
  return outputData;
243
-
244
248
  }
245
249
 
246
250
  static processPlayerContainer(data : Element | defaultType, version : number) {
@@ -106,7 +106,6 @@ export class LTPlayerCommon {
106
106
  }
107
107
  });
108
108
  }
109
-
110
109
  onReadyPlayer() {
111
110
 
112
111
  //set share button
@@ -116,9 +115,7 @@ export class LTPlayerCommon {
116
115
  //set poster
117
116
  this.player.posterManager.mobileEvents.onload(this.player);
118
117
 
119
- if (this.player.additionalInfoService) {
120
- this.player.additionalInfoService.init(this.player, this.player.playerId, this.player.iconService, this.player.templateService);
121
- }
118
+
122
119
 
123
120
  if (this.player.playerConfig.isAutoPlay()) {
124
121
  let playerContainer = this.player.plyr.elements.container;