I started by copy-pasting code from the Readme, but when that didn't provide a stream I refactored it to use async/await:
private async Task PublishTexture()
{
var rt = new UnityEngine.RenderTexture(1920, 1080, 24, RenderTextureFormat.ARGB32);
rt.Create();
Camera.main.targetTexture = rt;
var publish = _room.LocalParticipant.PublishTrack(
LocalVideoTrack.CreateVideoTrack("my-track", new TextureVideoSource(rt)),
new TrackPublishOptions { VideoCodec = VideoCodec.H264, Source = TrackSource.SourceScreenshare });
while (!publish.IsDone)
await Task.Yield();
if (publish.IsError)
Debug.LogError("There was an error publishing your videos.");
}
After following the Readme I have succeeded in publishing a Microphone stream, but I don't see any evidence that a video stream is working.
I'm using https://example.livekit.io/ to test.
I started by copy-pasting code from the Readme, but when that didn't provide a stream I refactored it to use async/await: