@latest-thinking/lt-player 1.2.0-a → 1.2.0-c

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.2.0-a",
3
+ "version": "1.2.0-c",
4
4
  "description": "LT player.",
5
5
  "main": "dist/js/lt-player-main.js",
6
6
  "module": "dist/js/lt-player-main.js",
@@ -60,6 +60,7 @@ body {
60
60
 
61
61
  .lt-player:has(.plyr--fullscreen-fallback) {
62
62
  container-type: normal;
63
+ z-index: 10;
63
64
 
64
65
  .plyr--video {
65
66
  background: black;
@@ -510,6 +510,11 @@ export namespace LTPlayerControlsEvents {
510
510
  const volumeRangeControl: HTMLElement = playerControlsContainer.querySelector('.volume_control__background__area__range');
511
511
  const rangeVolumesItems: NodeListOf<HTMLElement> = volume.querySelectorAll('.volume-max, .volume-75, .volume-50, .volume-mute');
512
512
 
513
+ const itemsDataSet: string[] = [];
514
+ rangeVolumesItems.forEach(item => {
515
+ itemsDataSet.push(item.dataset.rangeValue)
516
+ })
517
+
513
518
  openVolumeButton.addEventListener('mouseover', (event) => {
514
519
  volumeControl.classList.remove('d-none');
515
520
  volumeBackground.classList.remove('d-none');
@@ -544,28 +549,39 @@ export namespace LTPlayerControlsEvents {
544
549
  volumeIcons(1)
545
550
  })
546
551
 
547
- const volumeIcons = (range: any) => {
552
+ const getClosest = (curr: any, prev: any, range: any) => {
553
+ return (Math.abs(curr - range) < Math.abs(prev - range) ? curr : prev);
554
+ }
548
555
 
549
- if (typeof range == 'number') {
550
- range = range.toString()
551
- }
556
+ const volumeMax: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-max');
557
+ const volume75: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-75');
558
+ const volume50: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-50');
559
+ const volumeMute: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-mute');
560
+ const volumeBody: HTMLElement = playerControlsContainer.querySelector('.bottom-controller__volume_control');
561
+ const volumeIconsManger = (item: HTMLElement) => {
552
562
 
553
- const volumeMax: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-max');
554
- const volume75: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-75');
555
- const volume50: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-50');
556
- const volumeMute: HTMLElement = muteUnmuteVolumeButton.querySelector('.volume-mute');
557
- const volumeBody: HTMLElement = playerControlsContainer.querySelector('.bottom-controller__volume_control');
558
- const volumeIconsManger = (item: HTMLElement) => {
563
+ const rangeVolumesItems: NodeListOf<HTMLElement> = volumeBody.querySelectorAll('.volume-max, .volume-75, .volume-50, .volume-mute');
564
+
565
+ rangeVolumesItems.forEach(function (value) {
566
+ if (item.dataset.rangeValue === value.dataset.rangeValue) {
567
+ value.classList.remove('d-none');
568
+ } else {
569
+ value.classList.add('d-none')
570
+ }
571
+ })
572
+ }
559
573
 
560
- const rangeVolumesItems: NodeListOf<HTMLElement> = volumeBody.querySelectorAll('.volume-max, .volume-75, .volume-50, .volume-mute');
574
+ const volumeIcons = (level: any) => {
575
+ if (itemsDataSet.length === 0) {
576
+ return;
577
+ }
561
578
 
562
- rangeVolumesItems.forEach(function (value) {
563
- if (item.dataset.rangeValue === value.dataset.rangeValue) {
564
- value.classList.remove('d-none');
565
- } else {
566
- value.classList.add('d-none')
567
- }
568
- })
579
+ let range = itemsDataSet.reduce(function (prev, curr) {
580
+ return getClosest(curr, prev, level);
581
+ });
582
+
583
+ if (typeof range == 'number') {
584
+ range = range.toString()
569
585
  }
570
586
 
571
587
  switch (range) {
@@ -585,26 +601,7 @@ export namespace LTPlayerControlsEvents {
585
601
  }
586
602
 
587
603
  volumeRangeControl.addEventListener('input', function () {
588
-
589
- let itemsDataSet: string[] = [];
590
-
591
- rangeVolumesItems.forEach(item => {
592
- itemsDataSet.push(item.dataset.rangeValue)
593
- })
594
-
595
- if (itemsDataSet.length === 0) {
596
- return;
597
- }
598
-
599
- const getClosest = (curr: any, prev: any, range: any) => {
600
- return (Math.abs(curr - range) < Math.abs(prev - range) ? curr : prev);
601
- }
602
-
603
-
604
- let closest = itemsDataSet.reduce(function (prev, curr) {
605
- return getClosest(curr, prev, (volumeRangeControl as HTMLInputElement).value);
606
- });
607
- volumeIcons(closest);
604
+ volumeIcons((volumeRangeControl as HTMLInputElement).value);
608
605
  })
609
606
 
610
607
  instance.plyr.volume = 1;