@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/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/app.scss +1 -0
- package/src/components/controls/LTPlayerControlsEvents.ts +35 -38
package/package.json
CHANGED
package/src/assets/sass/app.scss
CHANGED
|
@@ -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
|
|
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
|
-
|
|
550
|
-
|
|
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
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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
|
-
|
|
574
|
+
const volumeIcons = (level: any) => {
|
|
575
|
+
if (itemsDataSet.length === 0) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
561
578
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
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;
|