I'm trying to capture a single frame from a mjpeg stream on an IP camera. I've successfully made the HTTP GET request to the endpoint, however, due to the nature of MJPEG streams, the response bytes are continually sent and the response is never closed, so http.Get just hangs.
Ideally, I would need to read the response bytes as they come in from the server, and as as soon as I detect the inter-frame boundary, close the connection. I've read through the net/http documentation, looking at Client and Transport but nothing I can find offers a way to read the response bytes before the response is finished.
Do I need to manually re-implement the HTTP request with a net.TCPConn in order to achieve this or is there some other way? Thanks.