[SOLVED] MJPEG Stream closes after 1 minute

I’m using motion running on another raspi to stream mjpeg feeds for display in OpenHAB’s BasicUI, which is working really well, even via myopenhab.org. Except that the stream closes after exactly one minute. That means the actual streams are still running, just OpenHAB seems to close the connection and the feed vanishes. i tried rendering via Video and Image on the sitemap, á la:

Image url="http://192.168.178.27:8082/"
Video url="http://192.168.178.27:8081/" encoding="mjpeg"

but still no luck…

Before i have to implement dirty hacks to make this work: Has anyone noticed this behaviour before? Any clues?

Edited to add some more debug info:

<div class="mdl-form__row mdl-form__row--height-auto mdl-cell mdl-cell--12-col ">
	<div
		class="mdl-form__control mdl-form__image"
		data-control-type="image"
		data-item=""
		data-update-interval="0"
		data-widget-id="0001"
		data-proxied-url="../proxy?sitemap=main.sitemap&amp;widgetId=0001"
		data-valid-url="true"
		data-ignore-refresh="false"
	>
		<img src="../proxy?sitemap=main.sitemap&amp;widgetId=0001&amp;t=1530476619635" />
	</div>
</div>
app:115 GET http://192.168.178.31:8080/proxy?sitemap=main.sitemap&widgetId=0001&t=1530476619635 200 (OK)
proxy:1 Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING

My fix was recently merged and should be available in the last snapshots.

1 Like

Thanks! Time to switch to snapshot then. Got a link to the commit? i’m kinda curious what it was.

Edit: seems like it’s still happening, openhab2 2.4.0~20180701105417-1

i should probably start building ESH myself, this is my quick fix for now:

/*
*
*   hack to avoid jetty mjpeg timeout
*
*/

var refreshImgInterval = setInterval(function()
{
    var d = new Date();
    $('*[data-widget-id="0000"] img',$parentdoc).attr("src", "../proxy?sitemap=main.sitemap&widgetId=0000&"+d.getTime());
    $('*[data-widget-id="0001"] img',$parentdoc).attr("src", "../proxy?sitemap=main.sitemap&widgetId=0001&"+d.getTime());

},30000);
1 Like