This message was deleted.
# helpdesk
s
This message was deleted.
a
hi Matt, our unity engineers are currently tangled up in other stuff this week so this response might be slow 😕 (I would help, but, I’m the one who wrote the Hi-fi audio docs, and the reason it doesn’t include Unity samples yet is… I don’t really know Unity 😅 )
@boundless-energy-78552 is screenshare audio supported in Unity?
d
Do you see any errors when setting this option under
ScreenShareCaptureOptions
?
i
@dry-elephant-14928 Nope, there isn't any error or message printed to the console. The screen share just doesn't initialize at all when I uncomment the
ScreenShareCaptureOptions
code above (nothing happens). If I comment it out again, then screen share does initialize and I can select which window I want to share, choose whether or not to share audio, etc. @acoustic-engineer-41666 Screenshare audio is definitely supported in Unity. Audio is enabled if I create a
ScreenShareCaptureOptions
with
Audio = true
. We've been using it to do virtual speaking events (streaming a Zoom call into a virtual space), but where we are having a big problem is streaming music into the space and getting really garbled/low-quality music audio. When I set the additional options (commented out in my above code) then I have the issue where screen share doesn't initialize at all.
Hey @boundless-energy-78552! Do you have any recommendations for this one? Thanks!
b
Hey, sorry Matt, I forgot to answer, feeling a bit sick rn. I’m going to answer you asap tomorrow 🙂
👍 1
i
Ok, thanks. Feel better!!
b
Can you try the defaults here
👀 1
i
Hey @boundless-energy-78552, thanks for your response. I attempted to fill in all the defaults that I could find, but I wasn't sure what to put for everything since it didn't all match up 1-to-1 with the Unity C# SDK (or maybe I missed some if it wasn't obvious where to track them down). Unfortunately I still have the same issue I described earlier, where nothing happens. Screen share doesn't initialize, no errors or warnings. If I revert to the previous code I shared in my original message, then screen share and audio works again (with garbled audio for music). Here is my most recent attempt:
Copy code
private IEnumerator BeginScreenShareRoutineNew()
{
    TrackPublishOptions trackPublishOptions = new TrackPublishOptions
    {
        Name = "ScreenShare_" + GameManager.Instance.GetUserID(),  // Append the instigator's user ID to the name of the screen share.
        Source = TrackSource.ScreenShare,
                
        videoEncoding = new VideoEncoding{ MaxBitrate = 1_700_000, MaxFramerate = 30 },
        ScreenShareEncoding = new VideoEncoding { MaxBitrate = 2_500_000, MaxFramerate = 15 },
        VideoCodec = LiveKit.VideoCodec.VP8,
        AudioBitrate = 32_000,
        DTX = false,
        Simulcast = true,
        StopMicTrackOnMute = false
        //VideoSimulcastLayers = ,  // ???
        //ScreenShareSimulcastLayers =  // ???
    };

    ScreenShareCaptureOptions screenShareCaptureOptions = new ScreenShareCaptureOptions
    {
        Audio = true,    // *Need* to set 'Audio = true' in order for screen share to include audio.
        AudioOptions = new AudioCaptureOptions    // *** Setting an AudioCaptureOptions within ScreenShareCaptureOptions BREAKS screen share. ***
        {
            AutoGainControl = true,
            ChannelCount = 2,
            //DeviceId = , // ???
            EchoCancellation = false,
            //Latency = ,   // ???
            NoiseSuppression = false
            //SampleRate = ,    // ???
            //SampleSize =      // ???
        }
        //Resolution = new VideoResolution
        //{
            //Width = , // Does all of this get automatically set?
            //Height = ,
            //FrameRate = ,
            //AspectRatio = 
        //}
    };

    yield return room.LocalParticipant.SetScreenShareEnabled(true, screenShareCaptureOptions, trackPublishOptions);
}
In the above, I included all of the options but commented out anything I wasn't sure about. For the above, could you please help me verify that I haven't made any mistakes, and help me add the missing settings that are necessary for high-fidelity audio via Unity C#? I really appreciate your help! 🙂 Also, maybe there is a bug and it would be best to directly test out high-fidelity music audio for Unity WebGL on your end? (This may also be a useful opportunity to form updated documentation for Unity high-fidelity audio)
b
Hey, yes this is a case I’ve never tested, I’m not sure when I’ll have an opportunity to take a look, can you fill an issue on GH? Maybe the ScreenShareCaptureOptions is simply not being serialized correctly to the JS side. (And maybe an error being swallowed?) I don’t think C# currently handle the default values correctly
i
Hey @boundless-energy-78552, yes I will go ahead and create an issue report on GitHub.
I'm hoping it won't be too bad to fix? Probably just some wires that need to be connected?
Hey @boundless-energy-78552, an issue report has been filed for this bug: https://github.com/livekit/client-sdk-unity-web/issues/44#issue-2014848217