microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
898 stars 277 forks source link

Hololens 2: RemoteAudioTrack.cs: OutputToDevice property does not mute native sound #849

Open tettogreen opened 2 years ago

tettogreen commented 2 years ago

Description Default implementation of PeerConnection.cs implies muting of Hololens 2 native sound:

        private void CreateNativePeerConnection()
        {
            // Create the peer connection managed wrapper and its native implementation
            _nativePeer = new WebRTC.PeerConnection();

            _nativePeer.AudioTrackAdded +=
                (RemoteAudioTrack track) =>
                {
                    // Tracks will be output by AudioReceivers, so avoid outputting them twice.
                    track.OutputToDevice(false);
                };
        }

However it doesn't - as a result by default application plays sound both from native audio and from AudioSource components in the scene.

Important Note: This function works as expected on the PC - no duplicated sounds are played together.

Environment

MRTK version: 2.7.2.0 Platform: UWP Architecture: ARM Unity version: 2020.3.25 Target device: HoloLens 2