This message was deleted.
# helpdesk
s
This message was deleted.
l
is the idea to create a ScreenShare track via
CreateLocalScreenTracks
and
await currentRoom.localParticipant.setScreenShareEnabled(true);
and treat this as any other Track via
RoomEvent.TrackSubscribed
API
p
Hi, you can have a look at the example of the js sdk repo https://github.com/livekit/client-sdk-js/blob/main/example/sample.ts you donโ€™t have to construct the screentracks yourself, calling
setScreenShareEnabled(true)
is enough by itself
l
thanks Lukas for the quick response, taking a look at the example
was able to make it work
this is so elegant
love that how it just picks WebAPI for screensharing and takes care of everything
๐Ÿ™Œ 1
out of box
Hey @polite-kilobyte-67570 I am trying to handle the screenpublishing for the player who initiated the publishing (in Unity)
Copy code
room.LocalTrackPublished += (publication, participant) =>
            {
                if(publication.Source == TrackSource.ScreenShare){
                    ScreenSharingSurface.UpdateTrack(publication.Track);
                }
            };

            room.LocalTrackUnPublished += ( publication, participant) =>
            {
                if(publication.Source == TrackSource.ScreenShare){
                    publication.Track.Detach();
                }
            };
The
LocalTrackUnPublished
callback is throwing the following compile error
Copy code
Assets/Scripts/GameManager.cs(75,18): error CS1061: 'Room' does not contain a definition for 'LocalTrackUnPublished' and no accessible extension method 'LocalTrackUnPublished' accepting a first argument of type 'Room' could be found (are you missing a using directive or an assembly reference?)
what am I doing wrong?
I want to hide the screen once the participant stop sharing their screen
p
cc @boundless-energy-78552
b
@lemon-animal-25306 Did you correctly import the LiveKit namespace ?
Or maybe it seems like there are multiple definitions of
Room
l
I think so
because if i remove that line, as in the pastebin, codecompiles
let me run the rest of the code and double check that
room.LocalTrackPublished
is working as intended
Replace
UnPublished
by
Unpublished
๐Ÿ‘ 2
p
is it just a typo
LocalTrackUnpublished
instead of
LocalTrackUnPublished
?
โž• 1
l
ouch ๐Ÿ˜…
fwiw, the docs page on LiveKit docs is one of the best docs i have seen
โค๏ธ 1
i was able to figure out a lot out by clicking around