I have a situation where videos reside on an FTP server, and I need to stream them through my Website Project.
Using a very crude method of including the FTP username and password in the URL, I can just drop the formed URL in as a link in the HTML video player.
http(s)://username:password#server
I am a bit stuck on how to proceed with consuming the video from this remote secured FTP site. There is no web server running to "serve" the videos over http. It is a dedicated FTP server.
Initially, I have played around with making a physical FTP connection from code, but the streaming seemed to be a problem using this method. I just temporarily used the URL authentication method, and it is time to revisit.
Unfortunately, I do not have the original code where I attempted to make the FTP connection through code.
I need to re-visit this, and would like some input before I proceed.
Video streaming is quite a specialist area, especially if you want to use techniques like Adaptive Bit Rate streaming (ABR - see note below) to give your users the best possible user experience.
Given this I think the best approach might be for your to FTP the videos to a streaming server where they can be prepared and made available for streaming properly.
There are open source and commercial streaming servers available, some cloud SaaS based, which means you don't have to invent and develop all this yourself. Some examples are:
https://gstreamer.freedesktop.org (opensource)
https://www.wowza.com (commercial with free trial)
Note: ABR - this essential means you have multiple versions of your video available on the server. Each is a different bit rate, and all are broken into (for example) 10 second chunks. The client requests the next chunk of the video from whatever is the most appropriate bit rate for the current network conditions. Many clients will also request a low bit rate to start the video to ensure a quick start and then 'step up' through the bit rates to the most appropriate one. You can see this when you start a new video on sites like Netflix etc.
Related
I have a service that allows uploads and downloads. This service is inside my Intranet environment and can only be accessed through a second service. It has two methods: one to upload a file and one to download a file. And in both cases, these files can be large, from several dozens of megabytes up to a few gigabytes...
I have a second gateway service on a system with two network cards. One network is to connect to the Intranet environment, the other connects to the outside World. This service requires user authentication through JWT's and also has two methods. One to upload and one to download files. But these methods require a JWT with an authenticated and authorized user. It has other methods to handle these logins.
Now, the problem is that when a user uploads a file, it first sends the file to the gateway until it is done uploading. The gateway then has to upload it to the file service. And the same in the other direction, as the file server first sends the file in a response to the gateway before the gateway sends it to the user. This is a big problem!
First of all, this slows things down considerably. It also eats up a lot of storage inside the gateway, which is annoying when dozens of users are busy uploading and downloading. So I need to speed things up.
I can't change anything to the file service, as it also does some data processing to incoming and outgoing files. It doesn't just store them, but also calculates checksums and maintains an index.
I am not allowed to use third-party components in the gateway due to security concerns. This service will be part of a banking portal and the client is quite paranoid about the connection to the Internet. In fact, there are a few more security layers in-between these services and the outside World. I just simplified things as my worry is just this Gateway.
Now, small amounts of data get passed through the gateway just fine, as this gateway also works well with other services. But in case of large files, I want to pass the data streams from the request or the response to pass through without the gateway having to store any. The gateway just has to check the headers and if everything is okay, it can forward the request stream to the file service or the response stream to the user.
At least, that's how it should work in my opinion. I just don't know how to do this in C# with a minimal Web API. (Yes, minimal API, so no controllers!) And although I thinkt here are some frameworks and libraries that might do this for me, my client has forbidden me to use them.
Annoying...
So, how to forward the request and response streams?
I'm trying to make a remote desktop app where user controls his pc from a webapp (as in logmein).
I achieved that with C# for the desktop part, and NodeJS for the webapp, the communication was made using Socket.IO.
My first attempt was capturing the screenshot (only 5 fps), then comparing it to the previous screenshot and sending only the difference in 8-bit image color which resulted - in a 800 * 600 resolution virtual desktop - in a 100kb first image, then from 5kb to 60Kb depending on the changes on the screen.
With my local machine controlling a virtualbox, everything was perfect, but when I hosted the webapp online, the result was catastrophic, an improbable lag was taking place.
After a few researches It turned out this kind of app was impossible to achieve with my way, and that I have to use a real-time protocol and make a live streaming out of the client screen.
My questions are :
Is there any free / open-source RTP libraries that is ready-to-use ?
How would-I transfer a live streaming from the desk app to the webapp since it's coming from the client side which has no open port ? I was thinking of another desktop app that will run on the server (hosting the webapp) and then it will stream the same content again, and then the webapp can simply display the content by acceding to the local ip with the RTP port, but this doesn't solve the mystery of transferring a live streaming from the client to the server ?
Is there any free / open-source RTP libraries that is ready-to-use ?
live555 - I've used and is excellent, but C++ so you would have to interop.
gstreamer - also native requiring interop.
Managed Media Aggregation I've not used but it is completely managed.
How would-I transfer a live streaming from the desk app to the webapp
since it's coming from the client side which has no open port ? I was
thinking of another desktop app that will run on the server (hosting
the webapp) and then it will stream the same content again, and then
the webapp can simply display the content by acceding to the local ip
with the RTP port, but this doesn't solve the mystery of transferring
a live streaming from the client to the server ?
This would be tricky. All the libraries above follow strict RTSP/RTP specification which requires opening a listening port on your host side, which is undoubtedly going to be behind a nat'd address. I would stick with each end being a client and reaching 'up' to your webservice. You also need to guarantee delivery of your frames (because your delivering incremental deltas) so RTP (which is traditionally over UDP) would be challenging.
Some thoughts
At the end of the day RTP is just a standardized 12 byte header and packetization rules for compressed media. It's not going to help with latency. The real benefit would allow you to connect to the endpoint with in a standards compliant way, like with a VLC client.
You could tune your sockets and that will help a bit but what I would focus on to be honest is compression and screen capture efficiency. What image compression are you using? VNC has traditionally used zlib and some others lossy like jpeg. The smaller you get those frames the better.
Also another thought which may help - Microsoft has an API for getting 'dirty screen areas'. It is called Desktop Duplication API and it performs incredibly fast. It is Win8 and up however.
All the best on your endeavor!
I am trying to develop a DISPLAY SYSTEM (PIS:Passenger Information System).Let me explain the problem .
The system includes LCDs that is located in Stations of Metro.The passenger can see the graphically movement of the trains .the sensors sense the train and send the information to our database .this information should be displayed on the LCD and the passengers can see the trains location and arrival time on the LCD,but where is my problem ?!!my project manager said to me the information should be displayed on the LCD using Adobe Flash .but my problem is how can send the information to SWF file .i googled it and i found i can use webservices but in fact i couldn't find any useful article about this could you please give me some help and method about this .
I should display the movement of trains of lcd ,so i should send the an array to swf.
You have a variety of options
Using URLLoader, which is basically AJAX sending text. You'd have to poll to the server though regularly. Any backend should be fine for this.
You could use AMF, which works similar to the option above. But binary data is send over HTTP, so it's more efficient, but the backend has to understand AMF as well.
You could use sockets, providing a simple two communication. The backend needs of course to be a socket server.
You could use web-sockets, which is basically the new cool way for full duplex communication. The backend has to implement the websockets protocol though. I used ws in the passed and was quite satisfied.
You can use SOAP based web services, but that is way to heavy and requires using Flex, if you want to use them out of the box.
My suggestion would be a simple REST server which gets accessed via URLLoader. In the ActionScript language reference, you find examples, which are sufficient for the client development.
On the other hand ... if the backend is already set up, ask the backend guys how to access the data - I mean the protocol - and implement the client with regards to the protocol being provided.
We have devices that can sync their data with an ftp server.
Each device should contain their own set of data (video files).
We do not want to duplicate this data for each device.
I was thinking along the lines of faking the ftp file list repsonse and rerouting each file request to another location using something similar to an httphandler. This way we only have to host our video files on one location and each device will still be able to get their own "set".
sftp is a "should have" for this scenario.
I tried searching anything along the lines of "ftp handler" but have not come up with any helpful results.
SUSE used to have a product (not written in C# though, and only for Linux) that does exactly what you want, the now abandoned Proxy Suite. I can confirm it works but I was never satisfied with its performance. Check it out, it might at least give you some ideas to work with should you want to develop such a contraption yourself.
Is it possible to emulate an ftp server?
No, it is not.
I was thinking along the lines of faking the ftp file list repsonse and rerouting each file request to another
location using something similar to an httphandler.
Do it.
Te problem is that this is not "faking", your server IS a FTP server implementing the FTP protocol. A "Fake" is impossible logically - either you implement the protocol, then you are a FTP server, or you do not, then you are not.
I tried searching anything along the lines of "ftp handler" but have not come up with any helpful results.
Google for "rfc ftp" and take it from there. That is RFC 959 and likely a dozen other ones. http://de.wikipedia.org/wiki/File_Transfer_Protocol lists 5 relevant RFC - 959, 1579, 2228, 2428 and 2640.
Alternatively looking for a programmable proxy may work - it is not that common, though, people seem to use HTTP more these days for file transfer, or system intrinsic protocols that have other features.
I need to implement an FTP service inside my .NET application (running as a Windows Service) and have not had much luck finding good/current source code or vendors. Ideally it needs to be able to respond to the basic FTP Protocol and accept the data stream from an upload via a stream, enabling me to process the data as it is being received (think on the fly hashing).
I need to be able to integrate it into my service because it will stack on top of our current code base with an existing custom TCP/IP communication protocol. I don't want to write (and then spend time debugging and performance testing) my own protocol, or implementation.
I have already found plenty of ftp client implementations, I just need an acceptable server solution.
There is an article about rolling your own FTP server in C# here. It's a bit old, but it might be complete enough for your requirements.
If you can get away from the need to process inbound data on-the-fly, I'd suggest just using an off-the-shelf FTP server (maybe even IIS), and process the received files from a folder. Your service could easily monitor this folder for new files. The other benefit of this is that files could be received even if your service is not running or restarting, and testing would be easier as you can drop your own files into the monitored folder.
Good luck!
Hope you find RemObjects free IP nice to use,
http://www.remobjects.com/ip.aspx
After installation you will see the samples.