How does the mjpeg_streamer example generate this HTML page? Can it be overridden with my own or customized?
The code for the mjpeg streamer is sent I the packet it sends. I suspect the webpage layout code is generated by the browser. Myabe Ibrahim knows.
I don’t think so, we can just control the headers.
Ibrahim,
I’m trying to send my own HTML page, however, I get an exception when I try to use readline or write on the socket. It seems like I can only use the socket.send or socket.recv methods. Although your documentation list the write and read methods.
http://docs.openmv.io/library/usocket.html?highlight=usocket
The exception occurs if I try this:
socket, sockaddr = server.accept()
…
…
(method, url, version) = socket.readline().split(b" ")
…
or
…
…
socket.write(“HTTP/1.1 OK\r\n\r\n”)
…
I get either:
‘socket’ object has no attribute ‘readline’
or
‘socket’ object has no attribute ‘write’
I think the docs are wrong. Those functions are not implemented in MicroPython STM socket module:
https://github.com/micropython/micropython/blob/master/ports/stm32/modusocket.c