mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 21:31:20 -08:00
添加muted功能
This commit is contained in:
1 parent
fa18560b2e
commit
3cd470a83c
10 files changed
+112
-70
No files matched your search
@@ -9,6 +9,10 @@ export default function attrInit(art, player) {
|
||||
$video[key] = option.moreVideoAttr[key];
|
||||
});
|
||||
|
||||
if (option.muted) {
|
||||
$video.muted = option.muted;
|
||||
}
|
||||
|
||||
if (option.volume) {
|
||||
$video.volume = clamp(option.volume, 0, 1);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,11 @@ export default function volumeMix(art, player) {
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(player, 'mute', {
|
||||
get: () => player.volume === 0,
|
||||
set: mute => {
|
||||
player.volume = mute ? 0 : storage.get('volume');
|
||||
Object.defineProperty(player, 'muted', {
|
||||
get: () => $video.muted,
|
||||
set: muted => {
|
||||
$video.muted = muted;
|
||||
art.emit('volumeChange', $video.volume);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user