Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for Video streaming with C#

Greeting, What is the best practice to do Video streaming between two clients using C#.

First client will have a windows app that allow to brows the second client PC and select a viedo file to play it in the first client PC via an IP address.

Thank you,

like image 298
Eyla Avatar asked Oct 20 '25 04:10

Eyla


2 Answers

For video streaming you should use the UDP protocol.

It's more efficient for real-time connections like video streaming to use UDP because dropped packets will quickly be replaced by new ones. And if you put some kind of ordering on the packets, you can reassemble them correctly at the receiving end.

You can create a UDP socket using System.Net.Sockets.UdpClient. Or if you want, use the System.Net.Sockets.Socket class to directly access the Winsock32 API.

like image 129
Misha Schoolov Avatar answered Oct 22 '25 19:10

Misha Schoolov


You should go for TCP/IP as transport layer, is faster than HTTP and is more suited for such large binary data. I would also use WCF (Windows Communication Foundation) which makes streaming very easy. If you never worked with WCF you could have streaming up and running inside a couple hours.

Here is a link about streaming and WCF.

like image 24
Liviu Mandras Avatar answered Oct 22 '25 19:10

Liviu Mandras



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!