From 2ada7b66db55dfe2996534881dccb743b1dfb3a0 Mon Sep 17 00:00:00 2001 From: Sergiu Toma Date: Mon, 19 Dec 2022 12:39:22 +0200 Subject: [PATCH] Update --- public/bundle.js | 21 ++++++++------------- public/index.html | 2 +- public/index.js | 21 ++++++++------------- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/public/bundle.js b/public/bundle.js index ccd5897..a137082 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -20385,22 +20385,17 @@ let consumerVideo // local consumer video(consumer not transport) let consumerAudio // local consumer audio(consumer not transport) const remoteSoundControl = document.getElementById('remoteSoundControl'); +remoteSoundControl.defaultMuted = true remoteSoundControl.addEventListener('click', function handleClick() { console.log('remoteSoundControl.textContent', remoteSoundControl.textContent); - remoteSoundControl.textContent = 'Button clicked'; - // let soundElementIcon = document.getElementById('sound') - // if (isSoundOn) { - // soundElementIcon.src = noSoundImage - // soundElementIcon.alt = 'no-sound-image' - // isSoundOn = false - // vid.muted = !isSoundOn - // } else { - // soundElementIcon.src = soundImage - // soundElementIcon.alt = 'sound-image' - // isSoundOn = true - // vid.muted = !isSoundOn - // } + if (remoteSoundControl.textContent === 'Unmute') { + vid.muted = false + remoteSoundControl.textContent = 'Mute'; + } else { + vid.muted = true + remoteSoundControl.textContent = 'Unmute'; + } }); // https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions diff --git a/public/index.html b/public/index.html index bf75988..9e54055 100644 --- a/public/index.html +++ b/public/index.html @@ -48,7 +48,7 @@
- +
diff --git a/public/index.js b/public/index.js index 520fbe7..1b1de28 100644 --- a/public/index.js +++ b/public/index.js @@ -27,22 +27,17 @@ let consumerVideo // local consumer video(consumer not transport) let consumerAudio // local consumer audio(consumer not transport) const remoteSoundControl = document.getElementById('remoteSoundControl'); +remoteSoundControl.defaultMuted = true remoteSoundControl.addEventListener('click', function handleClick() { console.log('remoteSoundControl.textContent', remoteSoundControl.textContent); - remoteSoundControl.textContent = 'Button clicked'; - // let soundElementIcon = document.getElementById('sound') - // if (isSoundOn) { - // soundElementIcon.src = noSoundImage - // soundElementIcon.alt = 'no-sound-image' - // isSoundOn = false - // vid.muted = !isSoundOn - // } else { - // soundElementIcon.src = soundImage - // soundElementIcon.alt = 'sound-image' - // isSoundOn = true - // vid.muted = !isSoundOn - // } + if (remoteSoundControl.textContent === 'Unmute') { + vid.muted = false + remoteSoundControl.textContent = 'Mute'; + } else { + vid.muted = true + remoteSoundControl.textContent = 'Unmute'; + } }); // https://mediasoup.org/documentation/v3/mediasoup-client/api/#ProducerOptions