I'm using twisted as part of my video streaming application, HTML5 video streaming relies heavily on byte-range for scrubbing... but FileSender doesn't seem to support byte-range (leading to a few problems).
Previously I was just passing everything through to Static.File.render_GET, which must have supported byte-ranges but due to a few changes since then that's no longer viable.
request.setHeader('Content-Type','video/octet-stream')
print request.getAllHeaders()
self.isLeaf = False
#return static.File.render_GET(self,request)
f = open('.path/to/file.mp4','rb')
def cbFinished(ignored):
f.close()
request.finish()
d = FileSender().beginFileTransfer(f,request)
d.addErrback(err).addCallback(cbFinished)
return NOT_DONE_YET
The code that gets passed a request if the requested filetype is 'mp4', and I've been getting errors like:
<GET /file.mp4 HTTP/1.1>
{'range': 'bytes=66673263716-', 'host': '192.168.1.64:8000', 'accept': '*/*', 'user-agent': 'Mozilla/5.0 (Nintendo WiiU) AppleWebKit/534.52 (KHTML, like Gecko) NX/2.1.0.8.23 NintendoBrowser/1.1.0.7579.EU'}
Unhandled Error
Traceback (most recent call last):
Failure: exceptions.Exception: Consumer asked us to stop producing
Unhandled Error
Traceback (most recent call last):
Failure: exceptions.RuntimeError: Producer was not unregistered for file.mp4
<GET /file.mp4 HTTP/1.1>
{'range': 'bytes=69839914264-', 'host': '192.168.1.64:8000', 'accept': '*/*', 'user-agent': 'Mozilla/5.0 (Nintendo WiiU) AppleWebKit/534.52 (KHTML, like Gecko) NX/2.1.0.8.23 NintendoBrowser/1.1.0.7579.EU'}
Which shows that the WiiU is requesting different byte-ranges, leading me to think that that's the problem.
Any help will be appreciated, thanks.