@latest-thinking/lt-player 1.0.8-g → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latest-thinking/lt-player",
3
- "version": "1.0.8-g",
3
+ "version": "1.0.8",
4
4
  "description": "LT player.",
5
5
  "main": "dist/js/lt-player-main.js",
6
6
  "module": "dist/js/lt-player-main.js",
@@ -5,6 +5,12 @@
5
5
  transform: translate(-#{$top}, -#{$top});
6
6
  }
7
7
 
8
+ @mixin flex-position($flex, $content, $align) {
9
+ display: $flex;
10
+ justify-content: $content;
11
+ align-items: $align;
12
+ }
13
+
8
14
  @mixin yellow-btn {
9
15
  color: $default-lt-button-color;
10
16
  background-color: $default_color_player;
@@ -14,7 +14,11 @@
14
14
  // 1. Basics
15
15
  //---------------------------------------------
16
16
 
17
-
17
+ *,
18
+ *::before,
19
+ *::after {
20
+ box-sizing: border-box;
21
+ }
18
22
 
19
23
  //---------------------------------------------
20
24
  // 2. Resetting properties
@@ -24,6 +28,18 @@ body {
24
28
  margin: 0;
25
29
  }
26
30
 
31
+ .container-text-portrait-player {
32
+ display: flex;
33
+ max-width: 800px;
34
+ max-height: 800px;
35
+ margin-bottom: 3rem;
36
+ }
37
+
38
+ .container-text-landscape-player {
39
+ display: flex;
40
+ max-width: 1000px;
41
+ }
42
+
27
43
  //---------------------------------------------
28
44
  // 3. General
29
45
  //---------------------------------------------
@@ -47,6 +63,10 @@ body {
47
63
  visibility: hidden;
48
64
  }
49
65
 
66
+ .overflow-hidden-body-important {
67
+ overflow: hidden !important;
68
+ }
69
+
50
70
  .d-none {
51
71
  display: none !important;
52
72
  }
@@ -1,5 +1,19 @@
1
1
  @import "../abstracts/variables";
2
2
 
3
+ $modal-max-width: 620px;
4
+
5
+ @mixin modal-max-width {
6
+ @media (max-width: #{$modal-max-width}) {
7
+ @content;
8
+ }
9
+ }
10
+
11
+ @mixin modal-min-width {
12
+ @media (min-width: #{$modal-max-width}) {
13
+ @content;
14
+ }
15
+ }
16
+
3
17
  @mixin modal-h2 {
4
18
  font-size: $lt-player-font-size-xxxl2;
5
19
  font-weight: $lt-player-font-weight-lg;
@@ -119,8 +133,8 @@
119
133
  &__modal-content {
120
134
  color: $default-lt-button-color;
121
135
  text-align: left;
122
- padding: 16px;
123
136
  overflow: auto;
137
+ padding: 20px;
124
138
  font-family: $lt-font-family-base;
125
139
 
126
140
  button,
@@ -169,11 +183,10 @@
169
183
  top: 0;
170
184
  width: 100%;
171
185
  height: 100%;
172
- background-color: rgba(0, 0, 0, 0.5);
173
- opacity: 0;
174
- visibility: hidden;
175
- transform: scale(1.1);
176
- transition: visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;
186
+
187
+ @include modal-min-width {
188
+ background-color: rgba(0, 0, 0, 0.5);
189
+ }
177
190
 
178
191
  &__mobile {
179
192
  position: absolute;
@@ -212,13 +225,18 @@
212
225
  border-radius: 0;
213
226
  font-family: $lt-font-family-base;
214
227
  width: 100%;
215
- max-height: 540px;
228
+ max-height: calc(100% - 50px);
216
229
  overflow: auto;
217
230
  max-width: 620px;
218
- padding: 40px 0;
219
231
 
220
- span {
221
- margin-right: 40px;
232
+ @include modal-max-width {
233
+ max-height: unset;
234
+ width: auto;
235
+ height: 100%;
236
+ position: unset;
237
+ transform: unset;
238
+ border: 1px solid $default-lt-span-color;
239
+ border-radius: 0 0 0 30px;
222
240
  }
223
241
 
224
242
  .modal-flex {
@@ -305,12 +323,15 @@
305
323
  }
306
324
 
307
325
  &__modal-body {
308
- padding: 0 40px;
326
+ padding: 40px;
327
+
328
+ @include modal-max-width {
329
+ padding: 20px;
330
+ }
309
331
  }
310
332
 
311
333
  &__close-button {
312
334
  z-index: 20;
313
- float: right;
314
335
  width: 24px;
315
336
  font-size: $lt-player-font-size-xxxl2 !important;
316
337
  line-height: 1;
@@ -321,24 +342,18 @@
321
342
  background-color: transparent;
322
343
  color: $default-lt-button-color;
323
344
  transition: color 0.12s ease-in-out;
324
- margin-bottom: 16px;
325
- position: sticky;
326
- top: 0;
345
+ position: absolute;
346
+ top: 40px;
347
+ right: 40px;
327
348
  margin-top: 0 !important;
328
349
 
329
- span {
330
- margin-top: 0;
350
+ @include modal-max-width {
351
+ top: 20px;
352
+ right: 20px;
331
353
  }
332
354
  }
333
355
 
334
356
  &__close-button:hover {
335
357
  color: #d75b4c;
336
358
  }
337
-
338
- &__show-modal {
339
- opacity: 1;
340
- visibility: visible;
341
- transform: scale(1.0);
342
- transition: visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s;
343
- }
344
359
  }
@@ -1,9 +1,3 @@
1
- .lt-player-portrate--mobile {
2
- .plyr {
3
- border-radius: 0;
4
- }
5
- }
6
-
7
1
  .lt-player-orientation--portrait {
8
2
  .plyr {
9
3
  iframe,
@@ -14,7 +14,16 @@ export class LTPlayerHls {
14
14
  this.instance = instance;
15
15
  this.config = instance.playerConfig;
16
16
  this.playerSettings = playerSettings;
17
- this.hlsInstance = new Hls();
17
+ this.hlsInstance = new Hls({
18
+ "enableWorker": true,
19
+ "lowLatencyMode": true,
20
+ "backBufferLength": 20,
21
+ "abrEwmaFastVoD": 1,
22
+ "autoStartLoad": true,
23
+ "abrBandWidthUpFactor": 0.95,
24
+ "maxMaxBufferLength": 15,
25
+ "abrEwmaDefaultEstimate": 50
26
+ });
18
27
  }
19
28
 
20
29
  init() {
@@ -76,6 +76,7 @@ export class LTPlayerAddInfoDesktop {
76
76
 
77
77
  if (modal) {
78
78
  modal.classList.add('player-lt__show-modal');
79
+ document.body.classList.add('overflow-hidden-body-important');
79
80
  }
80
81
 
81
82
  window.Player.players.forEach(item => {
@@ -97,6 +98,7 @@ export class LTPlayerAddInfoDesktop {
97
98
  let target = event.target as HTMLElement;
98
99
  if (target.classList.contains('player-lt__show-modal') || target.classList.contains('player-lt__close-button')) {
99
100
  modal.classList.remove('player-lt__show-modal');
101
+ document.body.classList.remove('overflow-hidden-body-important');
100
102
  document.querySelectorAll(".player-lt__modal").forEach(el => el.remove());
101
103
 
102
104
  window.Player.players.forEach(item => {
@@ -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 createInformationModal = (info: additionalInformation, key: string) => {
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
- mobile : true,
24
- modal : true,
25
- [controller.device] : true,
26
- object_data : true,
27
- [key] : info
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
- mobile : true,
32
- modal : true,
33
- data : info,
34
- [controller.device] : true
33
+ desktop: true,
34
+ modal: true,
35
+ id: `${key}-${controller.playerInstance.playerConfig.getPlayerId()}`,
36
+ data: info
35
37
  })
36
38
  }
37
39
 
38
- const modal = document.createElement('div');
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,17 +46,19 @@ 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
- playerControlsContainer.classList.add('player-lt__modal__mobile-show-modal');
56
+ let modal = document.querySelector(`.lt-modal-${targetModal}-${instance.playerInstance.playerConfig.getPlayerId()}`);
57
+
58
+ if (modal) {
59
+ modal.classList.add('player-lt__show-modal');
60
+ document.body.classList.add('overflow-hidden-body-important');
61
+ }
66
62
 
67
63
  window.Player.players.forEach(item => {
68
64
  if (item.plyr.playing) {
@@ -72,75 +68,46 @@ export class LTPlayerAddInfoMobile {
72
68
  }
73
69
  })
74
70
 
75
- __this.dragCloseModal(controller);
76
-
77
- controller.playerInstance.playerControl.mobileEvents.showControls(controller.playerInstance)
71
+ __this.closeModal(controller);
78
72
  })
79
73
  }
80
74
  })
81
-
82
-
83
75
  }
84
76
 
85
- dragCloseModal(controller: LTPLayerAddInfo.Controller) {
86
- const modalBody = document.querySelector('.lt-player-mobile-add-info-modal');
87
- const modalHeader = modalBody.querySelector('.player-lt__mobile__modal-header');
88
- const background = modalBody.querySelector('.player-lt__modal__mobile__background');
89
-
90
- const closeModal = () => {
91
- modalBody.remove();
92
- }
93
- if (modalHeader) {
94
- let mobileEvent: HammerManager = controller.playerInstance.eventInstance.mobileEvents.setMobileEvent(modalHeader);
95
- if (mobileEvent) {
96
- mobileEvent.on('pan', function LTPlayerMobileDragDownModal() {
97
- closeModal();
98
- window.Player.players.forEach(item => {
99
- if (item.pausedPlayer !== undefined) {
100
- if (item.pausedPlayer.isEmbed) {
101
- item.pausedPlayer.embed.play().then(function () {
102
- return;
103
- }).catch(function () {
104
- // an error occurred
105
- });
106
- }
107
-
108
- if (item.pausedPlayer.isHTML5) {
109
-
110
- item.pausedPlayer.play();
111
- return;
112
- }
113
- return;
114
- }
115
- })
116
- })
117
- }
118
- }
119
- if (background) {
120
- let mobileEvent: HammerManager = controller.playerInstance.eventInstance.mobileEvents.setMobileEvent(background);
121
- if (mobileEvent) {
122
- mobileEvent.on('singletap', function LTPlayerMobileCloseModal() {
123
- closeModal();
124
- window.Player.players.forEach(item => {
125
- if (item.pausedPlayer !== undefined) {
126
- if (item.pausedPlayer.isEmbed) {
127
- item.pausedPlayer.embed.play().then(function () {
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
+ }
128
104
  return;
129
- }).catch(function () {
130
- // an error occurred
131
- });
132
- }
133
-
134
- if (item.pausedPlayer.isHTML5) {
135
-
136
- item.pausedPlayer.play();
137
- return;
138
- }
139
- return;
105
+ }
106
+ })
140
107
  }
141
- })
142
- })
143
- }
108
+ }
109
+ });
110
+ })
144
111
  }
145
112
  }
146
113
  }
@@ -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 : 'triepletap',
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('triepletap').recognizeWith('doubletap');
212
- manager.get('doubletap').requireFailure('triepletap');
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
  }
@@ -212,34 +212,37 @@ export class ResizeService {
212
212
  }
213
213
  }
214
214
 
215
- if (containerWidth >= 380) {
215
+ // if (containerWidth >= 380) {
216
+ //
217
+ // if (this.addInfoInSide && (containerWidth + 70 <= 380)) {
218
+ // return;
219
+ // }
220
+ //
221
+ // if (this.addInfoOutSide) {
222
+ // return;
223
+ // }
224
+ //
225
+ // this.addInfoOutSide = true;
226
+ // this.addInfoInSide = false;
227
+ //
228
+ // createAddInfoButtonsOutSide();
229
+ // } else {
230
+ //
231
+ // if (this.addInfoOutSide && (containerWidth + 70 >= 380)) {
232
+ // return;
233
+ // }
234
+ //
235
+ // if (this.addInfoInSide) {
236
+ // return;
237
+ // }
238
+ //
239
+ // this.addInfoInSide = true;
240
+ // this.addInfoOutSide = false;
241
+ // createAddInfoButtonsInSide();
242
+ // }
243
+
244
+ createAddInfoButtonsInSide();
216
245
 
217
- if (this.addInfoInSide && (containerWidth + 70 <= 380)) {
218
- return;
219
- }
220
-
221
- if (this.addInfoOutSide) {
222
- return;
223
- }
224
-
225
- this.addInfoOutSide = true;
226
- this.addInfoInSide = false;
227
-
228
- createAddInfoButtonsOutSide();
229
- } else {
230
-
231
- if (this.addInfoOutSide && (containerWidth + 70 >= 380)) {
232
- return;
233
- }
234
-
235
- if (this.addInfoInSide) {
236
- return;
237
- }
238
-
239
- this.addInfoInSide = true;
240
- this.addInfoOutSide = false;
241
- createAddInfoButtonsInSide();
242
- }
243
246
  }
244
247
 
245
248
  protected setDimensions(containerWidth: number, containerHeight: number, defaultData: defaultType) {
@@ -1,5 +1,16 @@
1
1
  {{#modal}}
2
2
  {{#mobile}}
3
+ {{#data}}
4
+ <div class="player-lt__modal__mobile__background"></div>
5
+ <div class="player-lt__modal__mobile">
6
+ <div class="player-lt__mobile__modal-header">
7
+ <span class="line-button"></span>
8
+ </div>
9
+ <div class="player-lt__mobile__modal-content">
10
+ {{{data}}}
11
+ </div>
12
+ </div>
13
+ {{/data}}
3
14
  {{#object_data}}
4
15
  <div class="player-lt__modal__mobile__background"></div>
5
16
  <div class="player-lt__modal__mobile">
@@ -28,7 +39,6 @@
28
39
  </div>
29
40
  </div>
30
41
  {{/object_data}}
31
-
32
42
  {{/mobile}}
33
43
  {{#desktop}}
34
44
  {{#object_data}}
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
  {{/embedded}}
5
5
  {{#video}}
6
- <video class="embed_player lt-player-wrapper" playsinline controls>
6
+ <video class="embed_player lt-player-wrapper" playsinline controls crossorigin preload="none">
7
7
  <source src="{{videoUrl.videoUrl}}"/>
8
8
  {{#defaultConfig.captions}}
9
9
  <track kind="captions" label="{{label}} captions" src="{{url}}" srclang="{{srclang}}" {{default}} />