refactor: Update video element in Artplayer to support custom canvas or video

This commit is contained in:
Harvey Zack committed 2024-08-21 23:35:17 +08:00
1 parent 984755b442
commit ced8fb4fb1
4 files changed
+18 -15

No files matched your search

@@ -166,14 +166,14 @@ function artplayerProxyWebAV() {
videoWidth: 0,
videoHeight: 0,
currentTime: 0,
volume: 1,
autoplay: false,
playbackRate: 1,
paused: true,
ended: false,
readyState: 0,
muted: false,
buffered: 0
buffered: 0,
muted: option.muted,
volume: option.volume,
autoplay: option.autoplay
};
function reset() {
Object.assign(state, {
@@ -182,14 +182,14 @@ function artplayerProxyWebAV() {
videoWidth: 0,
videoHeight: 0,
currentTime: 0,
volume: 1,
autoplay: false,
playbackRate: 1,
paused: true,
ended: false,
readyState: 0,
muted: false,
buffered: 0
buffered: 0,
muted: option.muted,
volume: option.volume,
autoplay: option.autoplay
});
}
function stop() {
@@ -204,6 +204,7 @@ function artplayerProxyWebAV() {
}
function updateVolume() {
if (gainNode) {
console.log("updateVolume", state.volume);
const effectiveVolume = state.muted ? 0 : state.volume;
gainNode.gain.setValueAtTime(effectiveVolume, audioCtx.currentTime);
}