livekit / client-sdk-unity-web

Client SDK for Unity WebGL
Apache License 2.0
47 stars 15 forks source link

Window screen share not working #55

Open girish-d opened 1 week ago

girish-d commented 1 week ago

LiveKit Unity version: 1.5.1 Unity version: 2023.2.5 & 6.0.0.5

Steps to reproduce:

  1. Create a new WebGL project in Unity
  2. From the Package Manager import the LiveKit package (via the git URL)
  3. From the same Package Manager window, import the Livekit sample from the Samples tab
  4. In ExampleAssembly.asmdef under Assets\Samples\LiveKit WebGL SDK\1.5.1\Example\ExampleRoom, add the LiveKitBridge reference
  5. Generate a token in LiveKit Cloud
  6. In JoinScene.unity, copy the LiveKit Cloud project URL & token to the input fields under the UI Canvas
  7. Edit the ExampleRoom.cs file and add the following after line 50 (at the end of the Start() method):

yield return m_Room.LocalParticipant.SetScreenShareEnabled(true);

  1. Build and Run the project
  2. Accept all permission requests
  3. Click on the Connect button and accept the permission requests
  4. When the Screen Share dialog pops up, select the 'Window' tab and then select an open application window

Result: The video track shows up momentarily and then disappears.

The track gets created via the HandleAddedTrack() method in ExampleRoom.cs and then HandleRemovedTrack() gets called immediately after & the video track is removed.

NOTE: This does not happen when selecting any Chrome tab or the Entire Screen option in the Screen Share dialog. This can be tested by clicking on the Disconnect button in the RoomScene and then connecting again.

Expected Behaviour: Screen share video track is displayed like it is for the Chrome Tab and Entire Screen options.

Looks to be similar to this issue: https://github.com/livekit/client-sdk-flutter/issues/463