How is the HTML generated/overridden?
How is the HTML generated/overridden?
I'd like to customize the HTML page generated by this OpenMV mjpeg_streamer.py example, but I cannot figure out how it generates the HTML code or how to customize it (e.g. add a button to the page). Does anyone know how to do that?
https://github.com/openmv/openmv/blob/9 ... treamer.py
https://github.com/openmv/openmv/blob/9 ... treamer.py
Re: How is the HTML generated/overridden?
I think you will get much better answers at http://forums.openmv.io/
Re: How is the HTML generated/overridden?
I did, but unfortunately they don't know how the usocket generates the html in runtime or if it can be overridden.deshipu wrote:I think you will get much better answers at http://forums.openmv.io/
http://forums.openmv.io/viewtopic.php?f=6&t=470
Re: How is the HTML generated/overridden?
That's because usocket doesn't generate any HTML.
Re: How is the HTML generated/overridden?
Then I guess you are on the same page like the OpenMV folks.deshipu wrote:That's because usocket doesn't generate any HTML.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: How is the HTML generated/overridden?
@cagiva The code you cited in your OP is quite straightforward and the HTML is there in plain text. Unless I'm missing something you need some help from someone who knows HTML form design; alas not in my repertoire.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: How is the HTML generated/overridden?
Hi Peter,pythoncoder wrote:the HTML is there in plain text.
What you saw in the code are just the HTTP headers. I'm looking to customize/override the HTML body; which is implicitly generated when the JPEG images are streamed. For instance, when I open the "inspect element" option of the browser to check the code sent from the server, I notice that there is an IMG tag that is not in the OpenMV code. It just appears from nowhere and I don't know how it gets generated.
I'm just trying to figure out how to add an input button to the mysterious HTML body sent to the browser.
Last edited by cagiva on Thu Oct 12, 2017 5:21 pm, edited 1 time in total.
Re: How is the HTML generated/overridden?
The code generates a stream of images. There is no HTML in there what so ever. Your browser should be displaying those images directly, however, since the modern browsers go out of their way to complicate everything, your browser is adding some html around the stream of images to make the presentation "nicer". This is a bug in your browser, though it probably doesn't make any sense to report it, because they will call it a feature. The solution is to use a different browser that doesn't generate stupid html, compile your own version of that browser with the built-in html modified to your liking, or writing an explicit HTML file that you can open that would embed that image stream — you can start with the html you have copied from the browser. Just save it in a file, and open that.
Re: How is the HTML generated/overridden?
Can you please share the code once. Thanks
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: How is the HTML generated/overridden?
I never knew browsers did that While this is interesting, the way browsers render HTML doesn't strike me as being relevant to @cagiva's problem.
Is there any reason why the MPEG streaming code can't emit HTML for the button along with the image?
Is there any reason why the MPEG streaming code can't emit HTML for the button along with the image?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.