AgoraIO-Community / Agora_Unity_WebGL

WebGL plugin for Unity, beta release
MIT License
113 stars 25 forks source link

when ever video is mute, Still camera/ camera light is active #285

Closed subbu5280wipro closed 1 year ago

subbu5280wipro commented 1 year ago

i am using Agora webgl plugin. for video communication, I am using the Agora webgl beta plugin. As per the application, the User can able to share/unshare his video. Whenever a user shares his video it's fine. The device camera is active and the light is active. But Whenever the user unshares his video not able to switch off his camera or camera light.

nathanGroovy commented 1 year ago

when you mute the video track, it's still capturing the video stream data, which is why the light on the camera stays on. If you want to disable both the video track and the camera, you need to use enableLocalVideo from clientManager.js instead. But this too needs to be updated to work better. go into the SDK and find clientManager.js, locate the enableLocalVideo function and replace it with this:

// Disables/Re-enables the local audio function.
  async enableLocalVideo(enabled) {
    var enable = enabled == 1 ? true : false;
    console.log("EnableLocalVideo (clientManager):" + enable);
    if (this.client) {

      if(localTracks.videoTrack != null){
        localTracks.videoTrack.setEnabled(enable);
      }

    }
    this.videoEnabled = enable;
  }

do the same thing for enableLocalAudio in clientManager.js if needed:

// Disables/Re-enables the local audio function.
  async enableLocalAudio(enabled) {
    var enable = enabled == 1 ? true : false;
    console.log("EnableLocalAudio (clientManager):" + enable);
    if (this.client) {

      if(localTracks.audioTrack != null){
        localTracks.audioTrack.setEnabled(enable);
      }

    }
    this.audioEnabled = enable;
  }

Let us know if this works for you. Thanks for catching this bug for us. We'll update our WebGL SDK soon with these changes.

subbu5280wipro commented 1 year ago

Thank you so much its working fine.