Click here to Skip to main content
15,886,104 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how play video from ftp with .net?
Posted

1 solution

Quick answer is: bad idea. FTP cannot guarantee required frame rate. However, in practice, available media streaming solutions also do not guarantee uninterrupted supply of data required for smooth viewing, so you can try. Realistically, nothing prevents you from downloading of a whole media file from FTP to a temporary location and playing. To work with FTP, you need the class System.Net.FtpWebRequest:
http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^].

Look at the code sample at the end of this page. Normally, you are reading the data from the Stream you obtain from System.Net.FtpWebResponse using System.Net.FtpWebResponse.GetResponseString and read data by chunks, which can suit your purpose. Please see:
http://msdn.microsoft.com/en-us/library/system.net.ftpwebresponse.aspx[^],
http://msdn.microsoft.com/en-us/library/system.net.ftpwebresponse.getresponsestream.aspx[^].

Even though you can read data on the fly, streaming the data the way you can feed it to a player component is another big problem (again, think about downloading of the whole file to a temporary location and feeding the file location to the player). If you really want to solve the problem in a streaming-on-the-fly way, I would advice to look at the source code of VideoLAN project:
http://en.wikipedia.org/wiki/VideoLAN[^],
http://www.videolan.org/[^].

Even though this product is used mostly as a player, it was initially developed as a streaming solution and can be used for many different purposes, with UI or without it: streaming, media format conversion, media transformations on the fly, playing, chaining all of the operations on the fly and more. In principle, you can learn all of the techniques from the source code.

VideoLAN provides some interoperability with .NET. Please see if it can help you:
http://wiki.videolan.org/C_Sharp[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900