mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
格式化
This commit is contained in:
1 parent
0454f785be
commit
203ad0d3a0
75 files changed
+3120
-2904
No files matched your search
@@ -1,25 +1,30 @@
|
||||
import { clamp } from '../utils';
|
||||
|
||||
export default function volumeMix(art, player) {
|
||||
const { refs: { $video }, i18n, notice, storage } = art;
|
||||
const {
|
||||
refs: { $video },
|
||||
i18n,
|
||||
notice,
|
||||
storage,
|
||||
} = art;
|
||||
|
||||
Object.defineProperty(player, 'volume', {
|
||||
get: () => $video.volume || 0,
|
||||
set: percentage => {
|
||||
if (percentage !== undefined) {
|
||||
$video.volume = clamp(percentage, 0, 1);
|
||||
notice.show(`${i18n.get('Volume')}: ${parseInt($video.volume * 100)}`);
|
||||
if ($video.volume !== 0) {
|
||||
storage.set('volume', $video.volume);
|
||||
}
|
||||
art.emit('volumeChange', $video.volume);
|
||||
}
|
||||
}
|
||||
});
|
||||
Object.defineProperty(player, 'volume', {
|
||||
get: () => $video.volume || 0,
|
||||
set: percentage => {
|
||||
if (percentage !== undefined) {
|
||||
$video.volume = clamp(percentage, 0, 1);
|
||||
notice.show(`${i18n.get('Volume')}: ${parseInt($video.volume * 100, 10)}`);
|
||||
if ($video.volume !== 0) {
|
||||
storage.set('volume', $video.volume);
|
||||
}
|
||||
art.emit('volumeChange', $video.volume);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'mute', {
|
||||
value: () => {
|
||||
player.volume = 0;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(player, 'mute', {
|
||||
value: () => {
|
||||
player.volume = 0;
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user