mardi 19 janvier 2016

How to render images as a video without html5 (web application)

I have the following scenario: I have a camera that have a function to send me photo when I ask it for.(this is the only way I can work with this camera)

I keep application in a loop:

 $(function () {
        setInterval(function () {    
            var link = '@Url.Content("~/Home/Hello")';    
            var txt = Math.random();    
            link += '?';
            link += 'text=' + txt;

            document.getElementById('imgDiv').innerHTML = '<img src="' + link + '" alt="' + txt + '" />';    
        }, 200);    

This doen't work, it's slow, work only in LAN, but I have a WCF that returns this image as a stream so I return it to client like this:

public ActionResult Hello(string text)
            //Create new image
            Image img = new Bitmap(500, 500);
            Graphics g = Graphics.FromImage(img);

            //Do some drawing
            Font font = new Font("Arial", 24);
            PointF drawingPoint = new PointF(10, 10);

            g.DrawString(text, font, Brushes.Black, drawingPoint);

            //Return Image
            MemoryStream ms = new MemoryStream();
            img.Save(ms, ImageFormat.Png);

            ms.Position = 0;

            return new FileStreamResult(ms, "image/png");

I have digged for some solution and then I realize that I'm doing this in a completely wrong way.

I don't have to call images from server, it should send me, like sockets do.

Another part of solution is to create a buffer of pictures (not showing 1 by 1), and then transform the buffer into a video and show it while store more pictures parallely

But to do this I have to use html5, and my server does not suport it, I am working in windows server 2008.

So my quetion is:

Is this the way I should do this, if not, could you guys provide some other solutions.

Ps: I can't use html5

Aucun commentaire:

Enregistrer un commentaire