Hello,
I’m trying to add simple mute functionality to openvidu-js-node tutorial. I’m using get-a-room tutorial snippets.
Here is what I did.
I added following code into the index.html (above the leave session button):
<input class="btn btn-large btn-danger" type="button" id="buttonMuteVideo" onmouseup="muteVideo();" value="Wideo">
<input class="btn btn-large btn-danger" type="button" id="buttonMuteAudio" onmouseup="muteAudio();" value="Audio">
In app.js I added following code in to the top of the file:
var publisher;
var audioEnabled = true;
var videoEnabled = true;
& following code under the joinSession() function:
function muteAudio() {
audioEnabled = !audioEnabled;
publisher.publishAudio(audioEnabled);
}
function muteVideo() {
videoEnabled = !videoEnabled;
publisher.publishVideo(videoEnabled);
}
When I use these buttons I’m getting following errors in console:
Uncaught TypeError: Cannot read property 'publishVideo' of undefined
at muteVideo (app.js:133)
at HTMLInputElement.onmouseup ((index):123)
muteVideo @ app.js:133
onmouseup @ (index):123
app.js:120 Uncaught TypeError: Cannot read property 'publishAudio' of undefined
at muteAudio (app.js:120)
at HTMLInputElement.onmouseup ((index):124)
Can you help me please to figure out what I’m doing wrong?