Streaming binary data over http

I am viewing streaming binary data in a browser (via http). I am looking for opinions on good ways to do this. Ultimately, I will have a real-time data source, and I would like to manipulate this data and display it (in real time) in a browser. Firefox comes first, IE would be good ... but I'm not so picky. I have a firefox plugin that does what I need, but I would prefer something written in javascript / html that will work without having to install any plugins.

I looked at the MIME / media type with several types / x -mixed-replace, and it looks like this might be useful in this project, but I wanted to hear opinions on the best ways to do this (if any) before I spend too many hours on this way.

Flash will probably do the job, but again, I would like to avoid plugins. I would like to have the simplest solution (right?), Ideally with javascript / html.

I also studied the comet to see what this could do for me.

+3
source share
5 answers

A lot depends on what you want to do with the data. I guess I will do it.

Flash might be the easiest solution. This is a fairly common supplement that almost everyone should have by now; therefore, you do not risk incompatibility.

JavaScript was simply not considered a good platform for processing binary data - so there was not too much development in the area. I do not think that you will find a lot of help for what you want. Especially when you get a render point - if you cannot convert every binary to a canvas script , as this is the only dynamic visualization available in JavaScript.

IE can indeed be an exception, as you can use some ActiveX objects to do this for several file types. But then you cut out most of the other browsers.

+4
source

As for data streams and socket type connections, you can take a look at the APE (Ajax Push Engine) project. It allows you to configure an HTTP proxy with which your JavaScript can connect for real socket connections.

As for what to do with the data when it arrives, I made a proof of concept showing how you can work with raw PNG data, analyze it and display it in a browser. Check this.

+2
source

I had to do this exactly before the video (i.e. jpeg).

I note that you just said "binary data" ... is this image data or not? what is it?

multipart / x-mixed-replace works great in many browsers. I think this may even be supported in later versions of IE. This certainly works in all versions of firefox from about 5 years ago when I had to implement this. Webkit-based browsers may be supported, including Chrome and Safari.

However, in my opinion, this is really only suitable for LAN-based applications. The reason is because you are sending a lot of data. Instead of sending the difference between consecutive frames (if this video), you will send all the images every time. Depending on the number of users, this can also put a heavy load on the server for bandwidth.

Thus, while multipart / x-mixed-replace is by far the easiest to implement, this is not necessarily the most suitable solution. Again, this depends on your original data type.

For a video, you could theoretically write something in javascript to do this. In fact, if you use Google for a javascript video player, you can find it. I doubt they are terribly fast and are likely to put a heavy strain on the client machine. However, this seems doable.

So, your options: 1) Content type mixed-replace 2) Download the plugin Built-in browser plugin (the fastest of all the most effective) Flash or Silverlight 3) Javascript based player

If this is the video you need, the last parameter that is on the verge of bleeding, 4) HTML5 based video. http://www.html5video.org/ Since the standards are still ratified and browser support is limited, I would not recommend it at this time.

+2
source

You can use Base64 to convert binary code to text and send it to the browser. With IE, you can convert it directly to a binary, but I'm not sure if you can do this with Firefox and others. I saw jscripts for Base64 enflate / deflate and a script called base64.js, which probably also does the conversion.

However, you are probably better off converting binary data to JSON and use AJAX to transfer the data, and then treat it as a javascript object in the browser. The web server will be responsible for receiving the data and converting it to JSON, so you should be able to process binary files, no matter what programming language you use.

+1
source

I would not use multipart / x-mixed-replace at all, since it has pretty fragmentary browser support. I know that the multi-memories / x -mixed-replace of my cameras do not work on IE or later versions of Firefox (although, apparently, there is a setting for this).

I think a small Flash application might be one of your best options.

+1
source

All Articles