当我尝试加载一个较大的(50mb)视频时,服务器会抛出此错误:
[14/Mar/2016 02:16:13] "GET /media/media/uploads/SampleVideo_1280x720_50mb.mp4 HTTP/1.1" 200 52464391
[14/Mar/2016 02:16:13] "GET /media/media/uploads/SampleVideo_1280x720_50mb.mp4 HTTP/1.1" 200 286720
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
self.write(data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 217, in write
self._write(data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 328, in write
self.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 307, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 41] Protocol wrong type for socket
[14/Mar/2016 02:16:13] "GET /media/media/uploads/SampleVideo_1280x720_50mb.mp4 HTTP/1.1" 500 59
- Broken pipe from ('127.0.0.1', 52070)
正如您所看到的,在引发错误之前请求视频两次。这似乎是在整个视频加载之前套接字关闭时引起的。小视频不会抛出错误(在Chrome上 - 一切都会在Safari上引发错误)也支持这种情况。
我在开发服务器和html5中使用django 1.9将视频显示在页面上。
在收到所有数据包之前,我怎么能保持套接字打开?为什么这甚至会成为默认行为?在发送所有必需的数据之前,我想不出任何有用的应用程序让套接字关闭。
答案 0 :(得分:0)
使用AWS S3存储和处理媒体,此问题已在所有浏览器上修复。它必须与开发服务器有关。