- Home /
Making streaming between two devices
Hi,
I'm doing a project where I want to share the screen from one device to pass to other device through Unity Network. For this purppose, I do these steps:
From server device, I make a screen capture using the ReadPixels method from Texture2D class:
IEnumerator OnPostRender() { if(totalTime > 1 && !sendImage) { textureCapture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false); textureCapture.Apply(); yield return null; sendImage = true; } }
When sendImage variable is true, from Update method, I use the EncodeToJPG method to get array bytes from imagen and send it to client. I have to fragment the array bytes in 4 or 5 packets to send the image correctly.
When the client receive the array bytes, he sends a signal to server to capture a new screen and repeat all process.
The problem is that the frame rate in server is so slow, about 5 - 10 fps. I guess that the reason of this is by the screen capture.
Then, my question is: Is there another way to do this more fast?
Thanks and greetings!
Answer by thelghome · Jul 02, 2019 at 11:44 AM
FM Exhibition Tool Pack | Forum Provides demos of in-game/live video, audio streaming solution. All codes are written in C# and you can freely customise for your own project.
Your answer
Follow this Question
Related Questions
Show Screenshot image on GUI, linear color space , Need help 1 Answer
Application.CaptureScreenshot on a Texture2D? 1 Answer
Screenshot in WebGL 0 Answers
Texture2D saves as PNG correctly but doesn't display properly in RawImage 1 Answer
Texture2D.EncodeToPng() saves gray PNG, all texture data missing 1 Answer