parent
e954433289
commit
4d1bea502a
4 changed files with 0 additions and 69 deletions
|
|
@ -118,7 +118,6 @@ const el = {
|
||||||
vcChannelName: document.getElementById("vc-channel-name"),
|
vcChannelName: document.getElementById("vc-channel-name"),
|
||||||
voiceVideoBtn: document.getElementById("voice-video-btn"),
|
voiceVideoBtn: document.getElementById("voice-video-btn"),
|
||||||
voiceScreenBtn: document.getElementById("voice-screen-btn"),
|
voiceScreenBtn: document.getElementById("voice-screen-btn"),
|
||||||
voiceFilterBtn: document.getElementById("voice-filter-btn"),
|
|
||||||
voiceMuteBtn: document.getElementById("voice-mute-btn"),
|
voiceMuteBtn: document.getElementById("voice-mute-btn"),
|
||||||
voiceLeaveBtn: document.getElementById("voice-leave-btn"),
|
voiceLeaveBtn: document.getElementById("voice-leave-btn"),
|
||||||
videoGrid: document.getElementById("video-grid"),
|
videoGrid: document.getElementById("video-grid"),
|
||||||
|
|
@ -725,7 +724,6 @@ function stopAndClearAudioPipeline() {
|
||||||
state.voice.rawStream = null;
|
state.voice.rawStream = null;
|
||||||
state.voice.audioContext = null;
|
state.voice.audioContext = null;
|
||||||
state.voice.activeNoiseFilter = 'off';
|
state.voice.activeNoiseFilter = 'off';
|
||||||
updateVoiceFilterButton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopAndClearVideoPipeline() {
|
function stopAndClearVideoPipeline() {
|
||||||
|
|
@ -819,8 +817,6 @@ async function buildAudioPipeline(rawStream) {
|
||||||
state.voice.activeNoiseFilter = 'off';
|
state.voice.activeNoiseFilter = 'off';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateVoiceFilterButton();
|
|
||||||
|
|
||||||
// Metering/Speaking detection
|
// Metering/Speaking detection
|
||||||
const analyser = ctx.createAnalyser();
|
const analyser = ctx.createAnalyser();
|
||||||
analyser.fftSize = 512;
|
analyser.fftSize = 512;
|
||||||
|
|
@ -885,34 +881,6 @@ async function getDeepFilterModule() {
|
||||||
return state.voice.deepFilterModule;
|
return state.voice.deepFilterModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVoiceFilterButton() {
|
|
||||||
if (!el.voiceFilterBtn) return;
|
|
||||||
const requestedMode = state.voice.noiseFilterMode === 'deepfilter' ? 'DeepFilterNet3' : 'Off';
|
|
||||||
const activeMode = state.voice.activeNoiseFilter === 'deepfilter' ? 'DeepFilterNet3' : 'Off';
|
|
||||||
const activeSuffix = requestedMode === activeMode ? '' : ` (active: ${activeMode})`;
|
|
||||||
el.voiceFilterBtn.title = `Noise Filter: ${requestedMode}${activeSuffix}`;
|
|
||||||
el.voiceFilterBtn.innerHTML = state.voice.noiseFilterMode === 'deepfilter'
|
|
||||||
? '<i data-lucide="filter"></i>'
|
|
||||||
: '<i data-lucide="filter-x"></i>';
|
|
||||||
el.voiceFilterBtn.style.color = state.voice.noiseFilterMode === 'deepfilter'
|
|
||||||
? 'var(--green)'
|
|
||||||
: 'var(--text-muted)';
|
|
||||||
lucide.createIcons();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function toggleNoiseFilter() {
|
|
||||||
state.voice.noiseFilterMode = state.voice.noiseFilterMode === 'deepfilter' ? 'off' : 'deepfilter';
|
|
||||||
updateVoiceFilterButton();
|
|
||||||
if (!state.voice.joinedChannelId) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await leaveVoice();
|
|
||||||
await joinVoice();
|
|
||||||
} catch (err) {
|
|
||||||
console.error("failed to rejoin voice after filter change", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createLocalVoiceStream() {
|
async function createLocalVoiceStream() {
|
||||||
const useDeepFilter = state.voice.noiseFilterMode === 'deepfilter';
|
const useDeepFilter = state.voice.noiseFilterMode === 'deepfilter';
|
||||||
const constraints = {
|
const constraints = {
|
||||||
|
|
@ -1532,10 +1500,8 @@ async function init() {
|
||||||
|
|
||||||
el.voiceVideoBtn.onclick = toggleVideo;
|
el.voiceVideoBtn.onclick = toggleVideo;
|
||||||
el.voiceScreenBtn.onclick = toggleScreenShare;
|
el.voiceScreenBtn.onclick = toggleScreenShare;
|
||||||
if (el.voiceFilterBtn) el.voiceFilterBtn.onclick = toggleNoiseFilter;
|
|
||||||
el.voiceMuteBtn.onclick = toggleMute;
|
el.voiceMuteBtn.onclick = toggleMute;
|
||||||
el.voiceLeaveBtn.onclick = leaveVoice;
|
el.voiceLeaveBtn.onclick = leaveVoice;
|
||||||
updateVoiceFilterButton();
|
|
||||||
|
|
||||||
el.addSoundBtn.onclick = () => {
|
el.addSoundBtn.onclick = () => {
|
||||||
el.soundModal.classList.remove("hidden");
|
el.soundModal.classList.remove("hidden");
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@
|
||||||
<div class="vc-actions">
|
<div class="vc-actions">
|
||||||
<button id="voice-video-btn" title="Turn on Camera"><i data-lucide="video-off"></i></button>
|
<button id="voice-video-btn" title="Turn on Camera"><i data-lucide="video-off"></i></button>
|
||||||
<button id="voice-screen-btn" title="Share Screen"><i data-lucide="monitor-off"></i></button>
|
<button id="voice-screen-btn" title="Share Screen"><i data-lucide="monitor-off"></i></button>
|
||||||
<button id="voice-filter-btn" title="Noise Filter"><i data-lucide="filter"></i></button>
|
|
||||||
<button id="voice-mute-btn" title="Mute"><i data-lucide="mic"></i></button>
|
<button id="voice-mute-btn" title="Mute"><i data-lucide="mic"></i></button>
|
||||||
<button id="voice-leave-btn" title="Disconnect"><i data-lucide="phone-off"></i></button>
|
<button id="voice-leave-btn" title="Disconnect"><i data-lucide="phone-off"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ const el = {
|
||||||
vcChannelName: document.getElementById("vc-channel-name"),
|
vcChannelName: document.getElementById("vc-channel-name"),
|
||||||
voiceVideoBtn: document.getElementById("voice-video-btn"),
|
voiceVideoBtn: document.getElementById("voice-video-btn"),
|
||||||
voiceScreenBtn: document.getElementById("voice-screen-btn"),
|
voiceScreenBtn: document.getElementById("voice-screen-btn"),
|
||||||
voiceFilterBtn: document.getElementById("voice-filter-btn"),
|
|
||||||
voiceMuteBtn: document.getElementById("voice-mute-btn"),
|
voiceMuteBtn: document.getElementById("voice-mute-btn"),
|
||||||
voiceLeaveBtn: document.getElementById("voice-leave-btn"),
|
voiceLeaveBtn: document.getElementById("voice-leave-btn"),
|
||||||
videoGrid: document.getElementById("video-grid"),
|
videoGrid: document.getElementById("video-grid"),
|
||||||
|
|
@ -673,7 +672,6 @@ function stopAndClearAudioPipeline() {
|
||||||
state.voice.rawStream = null;
|
state.voice.rawStream = null;
|
||||||
state.voice.audioContext = null;
|
state.voice.audioContext = null;
|
||||||
state.voice.activeNoiseFilter = 'off';
|
state.voice.activeNoiseFilter = 'off';
|
||||||
updateVoiceFilterButton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopAndClearVideoPipeline() {
|
function stopAndClearVideoPipeline() {
|
||||||
|
|
@ -755,34 +753,6 @@ async function getDeepFilterModule() {
|
||||||
return state.voice.deepFilterModule;
|
return state.voice.deepFilterModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVoiceFilterButton() {
|
|
||||||
if (!el.voiceFilterBtn) return;
|
|
||||||
const requestedMode = state.voice.noiseFilterMode === 'deepfilter' ? 'DeepFilterNet3' : 'Off';
|
|
||||||
const activeMode = state.voice.activeNoiseFilter === 'deepfilter' ? 'DeepFilterNet3' : 'Off';
|
|
||||||
const activeSuffix = requestedMode === activeMode ? '' : ` (active: ${activeMode})`;
|
|
||||||
el.voiceFilterBtn.title = `Noise Filter: ${requestedMode}${activeSuffix}`;
|
|
||||||
el.voiceFilterBtn.innerHTML = state.voice.noiseFilterMode === 'deepfilter'
|
|
||||||
? '<i data-lucide="filter"></i>'
|
|
||||||
: '<i data-lucide="filter-x"></i>';
|
|
||||||
el.voiceFilterBtn.style.color = state.voice.noiseFilterMode === 'deepfilter'
|
|
||||||
? 'var(--green)'
|
|
||||||
: 'var(--text-muted)';
|
|
||||||
lucide.createIcons();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function toggleNoiseFilter() {
|
|
||||||
state.voice.noiseFilterMode = state.voice.noiseFilterMode === 'deepfilter' ? 'off' : 'deepfilter';
|
|
||||||
updateVoiceFilterButton();
|
|
||||||
if (!state.voice.joinedChannelId) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await leaveVoice();
|
|
||||||
await joinVoice();
|
|
||||||
} catch (err) {
|
|
||||||
console.error("failed to rejoin voice after filter change", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function buildAudioPipeline(rawStream) {
|
async function buildAudioPipeline(rawStream) {
|
||||||
const ctx = new AudioContext();
|
const ctx = new AudioContext();
|
||||||
state.voice.audioContext = ctx;
|
state.voice.audioContext = ctx;
|
||||||
|
|
@ -809,7 +779,6 @@ async function buildAudioPipeline(rawStream) {
|
||||||
state.voice.activeNoiseFilter = 'off';
|
state.voice.activeNoiseFilter = 'off';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateVoiceFilterButton();
|
|
||||||
|
|
||||||
// Metering/Speaking detection
|
// Metering/Speaking detection
|
||||||
const analyser = ctx.createAnalyser();
|
const analyser = ctx.createAnalyser();
|
||||||
|
|
@ -1475,10 +1444,8 @@ async function init() {
|
||||||
|
|
||||||
el.voiceVideoBtn.onclick = toggleVideo;
|
el.voiceVideoBtn.onclick = toggleVideo;
|
||||||
el.voiceScreenBtn.onclick = toggleScreenShare;
|
el.voiceScreenBtn.onclick = toggleScreenShare;
|
||||||
if (el.voiceFilterBtn) el.voiceFilterBtn.onclick = toggleNoiseFilter;
|
|
||||||
el.voiceMuteBtn.onclick = toggleMute;
|
el.voiceMuteBtn.onclick = toggleMute;
|
||||||
el.voiceLeaveBtn.onclick = leaveVoice;
|
el.voiceLeaveBtn.onclick = leaveVoice;
|
||||||
updateVoiceFilterButton();
|
|
||||||
|
|
||||||
el.addSoundBtn.onclick = () => {
|
el.addSoundBtn.onclick = () => {
|
||||||
el.soundModal.classList.remove("hidden");
|
el.soundModal.classList.remove("hidden");
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@
|
||||||
<div class="vc-actions">
|
<div class="vc-actions">
|
||||||
<button id="voice-video-btn" title="Turn on Camera"><i data-lucide="video-off"></i></button>
|
<button id="voice-video-btn" title="Turn on Camera"><i data-lucide="video-off"></i></button>
|
||||||
<button id="voice-screen-btn" title="Share Screen"><i data-lucide="monitor-off"></i></button>
|
<button id="voice-screen-btn" title="Share Screen"><i data-lucide="monitor-off"></i></button>
|
||||||
<button id="voice-filter-btn" title="Noise Filter"><i data-lucide="filter"></i></button>
|
|
||||||
<button id="voice-mute-btn" title="Mute"><i data-lucide="mic"></i></button>
|
<button id="voice-mute-btn" title="Mute"><i data-lucide="mic"></i></button>
|
||||||
<button id="voice-leave-btn" title="Disconnect"><i data-lucide="phone-off"></i></button>
|
<button id="voice-leave-btn" title="Disconnect"><i data-lucide="phone-off"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue