@latest-thinking/lt-player 1.0.4-k → 1.0.4-m

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.4-k",
3
+ "version": "1.0.4-m",
4
4
  "description": "LT player.",
5
5
  "main": "dist/js/lt-player-main.js",
6
6
  "module": "dist/js/lt-player-main.js",
@@ -27,6 +27,14 @@
27
27
  }
28
28
 
29
29
  &__controls {
30
+
31
+ &__mobile-background {
32
+ position: absolute;
33
+ width: 100%;
34
+ height: 100%;
35
+ z-index: 9999;
36
+ }
37
+
30
38
  &__shortcut-area {
31
39
 
32
40
  }
@@ -44,7 +44,7 @@
44
44
 
45
45
  .player-state {
46
46
  opacity: 0;
47
- transition: all 0.3s ease-in-out;
47
+ transition: all 0.8s ease-in-out;
48
48
  pointer-events: none;
49
49
  @extend %lt-player-btn;
50
50
  @include dark-btn;
@@ -54,7 +54,7 @@
54
54
 
55
55
  .active {
56
56
  opacity: 1;
57
- transition: all 0.3s ease-in-out;
57
+ transition: all 0.2s ease-in-out;
58
58
  }
59
59
  }
60
60
 
@@ -183,7 +183,7 @@
183
183
 
184
184
 
185
185
  .lt-player-notify {
186
- transition: background 0.8s;
186
+ transition: background 0.2s;
187
187
  //background: rgba(200,200,200,.4) radial-gradient(circle, transparent 1%, rgba(200,200,200,.4) 1%) center/15000%;
188
188
  opacity: 0;
189
189
  //opacity: 1;
@@ -114,11 +114,18 @@ export class LTPlayerManager {
114
114
 
115
115
  const setup = new LTPlayerSetup();
116
116
 
117
- return new Promise(resolve => {
118
- setup.init(playerConfig).then( result => {
119
- this.players.push(result);
120
- resolve(result);
121
- })
117
+ return new Promise((resolve, reject) => {
118
+ let setupPLayer = setup.init(playerConfig);
119
+
120
+ if (setupPLayer) {
121
+ setupPLayer.then( result => {
122
+ this.players.push(result);
123
+ resolve(result);
124
+ })
125
+ } else {
126
+ reject('Player is not setup')
127
+ }
128
+
122
129
  })
123
130
 
124
131
 
@@ -65,16 +65,16 @@ export class LTPlayerSetup {
65
65
  }
66
66
 
67
67
  if (!playerConfig.body.playerType) {
68
- return new Promise(resolve => {
68
+ return new Promise((resolve, reject) => {
69
69
  playerConfig.body.playerType = this.getVideoTypeByUrl(playerConfig.body.videoUrl).then(response => {
70
70
  playerConfig.body.playerType = response;
71
- resolve(this.setType(playerConfig, playerContainer))
71
+ resolve(this.setType(playerConfig, playerContainer));
72
72
  });
73
73
  })
74
74
  } else {
75
-
76
- return new Promise(resolve => {
77
- resolve(this.setType(playerConfig, playerContainer))
75
+ return new Promise((resolve, reject) => {
76
+ resolve(this.setType(playerConfig, playerContainer));
77
+ reject(null);
78
78
  });
79
79
  }
80
80
  }
@@ -186,6 +186,9 @@ export namespace LTPlayerAdditionalInfo {
186
186
  if (background) {
187
187
  background.classList.add('d-none');
188
188
  }
189
+
190
+ controller.playerInstance.playerControl.mobileEvents.showControls(controller.playerInstance);
191
+
189
192
  }, 150)
190
193
 
191
194
  }
@@ -39,8 +39,8 @@ export namespace LTPlayerControlsEvents {
39
39
  setTimeout(() => {
40
40
  playInfoIcon.classList.add('d-none');
41
41
  pauseInfoIcon.classList.add('d-none');
42
- }, 300)
43
- }, 300)
42
+ }, 500)
43
+ }, 500)
44
44
 
45
45
  }
46
46
 
@@ -375,27 +375,29 @@ export namespace LTPlayerControlsEvents {
375
375
  }
376
376
  seekBar(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
377
377
  const playerControlsContainer = instance.plyr.elements.controls;
378
- const seekBar = playerControlsContainer.querySelector('.plyr__progress__seek');
378
+ const seekBar: HTMLInputElement = playerControlsContainer.querySelector('.plyr__progress__seek');
379
379
  const rangeTouch = require('rangetouch');
380
380
  rangeTouch.setup(seekBar);
381
+ const __this = this;
382
+ seekBar.addEventListener('change', () => {
383
+ __this.showControls(instance);
384
+ })
385
+
381
386
  }
382
387
 
383
388
  controlsTimeShow(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
384
389
  const playerContainer = instance.plyr.elements.container;
385
- const playerControlsContainer = instance.plyr.elements.controls;
390
+ const playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
386
391
  const __this = this;
392
+ if (playerControlsBackground) {
393
+ let mobileEvent: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(playerControlsBackground);
387
394
 
388
- let mobileEvent: HammerManager = instance.eventInstance.mobileEvents.setMobileEvent(playerControlsContainer);
389
-
390
- if (mobileEvent) {
391
- mobileEvent.on('singletap', function LTPlayerMobileFullScreen() {
392
-
393
- if (!playerContainer.classList.contains('plyr__controls-enable')) {
395
+ if (mobileEvent) {
396
+ mobileEvent.on('singletap', function LTPlayerMobileBack() {
394
397
  __this.showControls(instance);
395
- }
396
- })
398
+ })
399
+ }
397
400
  }
398
-
399
401
  }
400
402
 
401
403
  removePlyrControlsClass(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
@@ -410,11 +412,19 @@ export namespace LTPlayerControlsEvents {
410
412
 
411
413
 
412
414
  showControls(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
413
-
414
415
  const playerContainer = instance.plyr.elements.container;
415
416
  const playerControlsContainer = instance.plyr.elements.controls;
417
+ let playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
418
+
419
+ if (playerContainer.classList.contains('plyr--hide-controls')) {
420
+ playerContainer.classList.remove('plyr--hide-controls');
421
+ }
416
422
 
417
- playerContainer.classList.remove('plyr--hide-controls');
423
+ if (playerControlsBackground) {
424
+ if (!playerControlsBackground.classList.contains('d-none')) {
425
+ playerControlsBackground.classList.add('d-none');
426
+ }
427
+ }
418
428
 
419
429
  if (!playerControlsContainer.classList.contains('plyr__controls-enable')) {
420
430
  playerControlsContainer.classList.add('plyr__controls-enable');
@@ -430,11 +440,17 @@ export namespace LTPlayerControlsEvents {
430
440
  hideControls(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
431
441
  const playerContainer = instance.plyr.elements.container;
432
442
  const playerControlsContainer = instance.plyr.elements.controls;
433
- this.controlsTimeOut = setTimeout(() => {
434
- playerControlsContainer.classList.remove('plyr__controls-enable');
435
- playerContainer.classList.add('plyr--hide-controls');
436
- }, 4000);
437
-
443
+ let playerControlsBackground = playerContainer.querySelector('.plyr__controls__mobile-background');
444
+
445
+ if (!playerControlsContainer.classList.contains('plyr__controls-enable-addInfo')) {
446
+ this.controlsTimeOut = setTimeout(() => {
447
+ playerControlsContainer.classList.remove('plyr__controls-enable');
448
+ playerContainer.classList.add('plyr--hide-controls');
449
+ if (!playerControlsContainer.classList.contains('player-lt__modal__mobile-show-modal')) {
450
+ playerControlsBackground.classList.remove('d-none');
451
+ }
452
+ }, 4000);
453
+ }
438
454
  }
439
455
 
440
456
  fullScreenButtons(instance: LTPlayer.PortraitType | LTPlayer.LandscapeType) {
@@ -469,6 +485,7 @@ export namespace LTPlayerControlsEvents {
469
485
  instance.plyr.togglePlay(true);
470
486
  }
471
487
  common.playPauseIconTimeUpdate(instance);
488
+ instance.playerControl.mobileEvents.showControls(instance);
472
489
  });
473
490
  }
474
491
  }
@@ -501,6 +518,7 @@ export namespace LTPlayerControlsEvents {
501
518
  setTimeout(() => {
502
519
  common.backwardRewind.animateNotificationOut(selectors.forwardAnimation)
503
520
  }, 500)
521
+ instance.playerControl.mobileEvents.showControls(instance);
504
522
  })
505
523
 
506
524
  mobileEvent.on('singletap', function LTPlayerMobileForwardDbClick() {
@@ -518,6 +536,7 @@ export namespace LTPlayerControlsEvents {
518
536
  setTimeout(() => {
519
537
  common.backwardRewind.animateNotificationOut(selectors.rewindAnimation)
520
538
  }, 500)
539
+ instance.playerControl.mobileEvents.showControls(instance);
521
540
  })
522
541
 
523
542
  mobileEvent.on('singletap', function LTPlayerMobileRewindClick() {
@@ -586,6 +605,7 @@ export namespace LTPlayerControlsEvents {
586
605
  mobileEvent.on('singletap', function LTPlayerMobileRewindClick() {
587
606
  let volumeState = setVolume();
588
607
  setVolumeIcon(volumeState);
608
+ instance.playerControl.mobileEvents.showControls(instance);
589
609
  })
590
610
 
591
611
  }
@@ -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
  }
@@ -3,6 +3,14 @@ export class LTPlayerRotateDeviceService {
3
3
  }
4
4
 
5
5
  getDeviceOrientation() {
6
- return screen.orientation.type.replace('-primary', '');
6
+ console.log(window.matchMedia("(orientation: portrait)").matches)
7
+ if (window.matchMedia("(orientation: portrait)").matches) {
8
+ return 'portrait';
9
+ }
10
+
11
+ if (window.matchMedia("(orientation: landscape)").matches) {
12
+ return 'landscape';
13
+ }
14
+ return 'portrait';
7
15
  }
8
16
  }
@@ -136,19 +136,20 @@ export class ResizeService {
136
136
  protected setAddInfoByDimensions(containerWidth: number, buttonsTemplate:string, deskEvent: LTPlayerAdditionalInfo.Desktop, controller: LTPLayerAddInfo.Controller) {
137
137
 
138
138
  const createAddInfoButtonsOutSide = () => {
139
- let addInfoContainer = document.querySelector('.lt-player__additional-info');
139
+
140
+ let addInfoContainer = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
140
141
  if (addInfoContainer) {
141
142
  addInfoContainer.remove();
142
143
  }
143
144
 
144
145
  this.playerInstance.plyr.elements.container.insertAdjacentHTML("afterend", buttonsTemplate);
145
- let inserted = document.querySelector('.lt-player__additional-info');
146
+ let inserted = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
146
147
  inserted.classList.add('lt-player__additional-info__is_set_out-side');
147
148
  deskEvent.set(controller);
148
149
  }
149
150
 
150
151
  const createAddInfoButtonsInSide = () => {
151
- let addInfoContainer = document.querySelector('.lt-player__additional-info');
152
+ let addInfoContainer = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
152
153
  if (addInfoContainer) {
153
154
  addInfoContainer.remove();
154
155
  }
@@ -156,7 +157,7 @@ export class ResizeService {
156
157
  let controlsInfoBody = this.playerInstance.plyr.elements.controls.querySelector('.content__body');
157
158
 
158
159
  controlsInfoBody.insertAdjacentHTML("afterend", buttonsTemplate);
159
- let inserted = document.querySelector('.lt-player__additional-info');
160
+ let inserted = this.playerInstance.playerConfig.getPlayerElementContainer().querySelector('.lt-player__additional-info');
160
161
  inserted.classList.add('lt-player__additional-info__is_set_in-side');
161
162
  deskEvent.set(controller);
162
163
  }
@@ -166,6 +166,9 @@
166
166
  <div class="player-lt__modal__mobile__background d-none"></div>
167
167
  <div class="player-lt__modal__mobile d-none"></div>
168
168
  </div>
169
+ {{#mobile}}
170
+ <div class="plyr__controls__mobile-background d-none"></div>
171
+ {{/mobile}}
169
172
  {{/landscape}}
170
173
  {{#portrait}}
171
174
  <div class="plyr__controls">
@@ -303,5 +306,8 @@
303
306
  <div class="player-lt__modal__mobile__background d-none"></div>
304
307
  <div class="player-lt__modal__mobile d-none"></div>
305
308
  </div>
309
+ {{#mobile}}
310
+ <div class="plyr__controls__mobile-background d-none"></div>
311
+ {{/mobile}}
306
312
  {{/portrait}}
307
313
  {{/player}}