This message was deleted.
# helpdesk
s
This message was deleted.
m
cc @boundless-energy-78552
i
@rapid-exabyte-31869 Have you looked at this example https://github.com/livekit-examples/unity-webgl-demo
Although you are probably trying to change it on the fly, am I right?
r
Yes, you are right. It is possible? Or I need t disconect and recnnect?
i
Sorry, something I haven't delved into quite yet but would imagine it is possible.
r
Fixed!! + Refactor!!
// Update the LocalVideoTrack
IEnumerator SetVideoDevice(string deviceId) { if (LocalCamera != null) _room.LocalParticipant.UnpublishTrack(LocalCamera); LocalCamera?.Stop(); LocalCamera?.Detach(); var f = Client.CreateLocalVideoTrack(new VideoCaptureOptions() { DeviceId = deviceId }); yield return f; if (f.IsError) yield break; LocalCamera = f.ResolveValue; var video = f.ResolveValue.Attach() as HTMLVideoElement; video.VideoReceived += tex => { _localVideo.texture = tex; }; _room.LocalParticipant.PublishTrack(LocalCamera); print("Siwtch video device completed!"); }
🙌 1