Skip to content

Commit d2ebcd7

Browse files
committed
Update clientmanager.js
1 parent 5742e59 commit d2ebcd7

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

Assets/WebGLTemplates/AgoraTemplate/AgoraWebSDK/libs/clientmanager.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -587,19 +587,8 @@ class ClientManager {
587587
this.audioSubscribing = enabled;
588588
}
589589

590-
// Disables/Re-enables the local audio function.
591-
async enableLocalAudio(enabled) {
592-
if (enabled == false) {
593-
if (localTracks.audioTrack) {
594-
localTracks.audioTrack.setVolume(0);
595-
}
596-
} else {
597-
if (localTracks.audioTrack) {
598-
localTracks.audioTrack.setVolume(100);
599-
}
600-
}
601-
this.audioEnabled = enabled;
602-
}
590+
591+
603592

604593
// mutes the video stream by calling setMuted in the video track.
605594
// if mute is equal to true, then the videoTrack will be muted
@@ -635,6 +624,20 @@ class ClientManager {
635624
this.videoEnabled = enable;
636625
}
637626

627+
// Disables/Re-enables the local audio function.
628+
async enableLocalAudio(enabled) {
629+
var enable = enabled == 1 ? true : false;
630+
console.log("EnableLocalAudio (clientManager):" + enable);
631+
if (this.client) {
632+
633+
if(localTracks.audioTrack != null){
634+
localTracks.audioTrack.setEnabled(enable);
635+
}
636+
637+
}
638+
this.audioEnabled = enable;
639+
}
640+
638641

639642
async startPreview() {
640643
console.log(localTracks.videoTrack);

0 commit comments

Comments
 (0)