Error loading http stream

Given a simple web server @ local
streaming h.264 video using picamera2
streams to localhost:port in browser

As a developer creating a stream media source asset and providing the the correct host and port

the below error is received upon trying to open the media source.

ERROR

LogAvfMedia:

  • Warning: Failed to load video tracks.
  • The operation couldn’t be completed.

CoreMediaErrorDomain error -12939

  • byte range length mismatch - should be length 2 is length 182)

see below for example web server implementation.

Notes.
Possible header length is incorrect.

  • but given

content = PAGE.encode(‘utf-8’)
self.send_header(‘Content-Length’, len(content))

???

python code looks ok to me.
have you tried this on the web?
quite possibly though ue is trying to use a technique that queries the file before actually loading.
requesting only 2 bytes and you send the whole frame. this is very common but your code is a more simple implementation.
or maybe you’re only sending 2 bytes.

check this

might be good to ensure this is not a CORS issue.