libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [libmicrohttpd] Stopping MJPEG streams


From: David J Myers
Subject: RE: [libmicrohttpd] Stopping MJPEG streams
Date: Wed, 9 Feb 2011 11:58:13 -0000

Hi Christian,
Actually it seems to work better in Firefox than it does in Chrome. In
firefox, when you switch away from one stream, it mostly, but not always,
times out and you get a call to the MHD_Content_Reader_free_Callback.
However I still end up with video streams continuing unwatched in the
background.

I tried the "video" instead of "img" idea and it doesn't seem to be
supported, at least I can't get it to work for me.

Your other idea to detect the new request for blank and stop the stream is
good, but how do I know which thread to kill when a new request comes in.
There may be multiple clients (even multiple browsers on the same client)
watching the same video streams.

Best regards
David

-----Original Message-----
From: Christian Grothoff [mailto:address@hidden 
Sent: 09 February 2011 08:40
To: address@hidden
Cc: David J Myers
Subject: Re: [libmicrohttpd] Stopping MJPEG streams

On Tuesday 08 February 2011 19:38:10 David J Myers wrote:
> Hi,
> 
> I'm having some trouble with my streaming MJPEG webserver. It's basically
> about how a client webpage can cause the stream to stop and trigger the
> MHD_Content_Reader_free_Callback.
> 
> 
> 
> The webserver uses MHD_create_response_from callback with
MHD_SIZE_UNKNOWN,
> and the Daemon is set for 2 second client timeouts.
> 
> 
> 
> So the webpage starts the stream with this line of html.
> 
> 
> 
>     <td rowspan="2" align="center" valign="top" style="border-right:dashed
> 1px grey;"><div id="div1" style="width:640px; height:480px; border:solid
> 1px red; position:relative; left:0px"><img src="mjpg/video.cgi?view=1"
> name="main1" /> </div>

Hi David,

Philipp Toelke suggests putting "video" instead of "img" in the HTML.  
Personally, IDK (this is more a browser/JavaScript issue than an HTTP/MHD 
issue). On the server side, you may be able to detect the request to 'blank'

and stop sending, but I don't think that would be clean.

Happy hacking,

-Christian
 
> 
> 
> Then there is a button on the webpage to stop the video, which causes this
> javascript function to execute
> 
> 
> 
> function stop()
> 
> {
> 
>        eval('document.main1.src="images/blank.jpg"');
> 
> }
> 
> 
> 
> The blank jpeg is drawn into the div, but the webserver continues to
stream
> the video and the reader free callback isn't triggered.
> 
> 
> 
> Does anyone know how I can stop the stream without totally navigating away
> from the page?
> 
> 
> 
> Thanks and regards
> 
> 
> 
> David Myers




reply via email to

[Prev in Thread] Current Thread [Next in Thread]