2013-08-03 143 views
8

我通過使用python -m SimpleHTTPServer調用服務器來將文件夾中的文件共享到其他設備。音頻/視頻流使用SimpleHTTPServer失敗

我只是想流視頻/音頻(標準MP4 & MP3,無論是在20MB)到另一臺計算機使用此&它WORKS(但在終端拋出的錯誤(下上市))。

不知何故,視頻/音頻失敗(除了非常小的MP3文件)與iPhone/iPad的Safari玩。它絕對與媒體文件無關,因爲我在iPhone中使用Apache成功傳輸它們。

任何想法爲什麼會發生?

Exception happened during processing of request from ('192.168.1.2', 51775) 
Traceback (most recent call last): 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock 
    self.process_request(request, client_address) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request 
    self.finish_request(request, client_address) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request 
    self.RequestHandlerClass(request, client_address, self) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__ 
    self.finish() 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish 
    self.wfile.flush() 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush 
    self._sock.sendall(view[write_offset:write_offset+buffer_size]) 
error: [Errno 32] Broken pipe 
+1

查看這些[alternatives](http://stackoverflow.com/questions/12905426/faster-alternative-to-pythons-simplehttpserver)到Python的SimpleHTTPServer模塊。 – mtadd

回答

6

作爲sugested要麼使用Python替代,What is a faster alternative to Python's http.server (or SimpleHTTPServer)?或完全使用全噴射織物serwer。 Quick google表示Mac支持Nignx和Apache2。

+2

感謝您選擇鏈接,但[標記的答案](http://stackoverflow.com/a/12905427/2602869)建議[http-server](https://github.com/nodeapps/http-server )(對於node.js)似乎沒有流式傳輸視頻文件。但是,[twistd](http://twistedmatrix.com)(對於Python)如[另一個答案](http://stackoverflow.com/a/14618010/2602869)中所解釋的那樣很好! –

+0

@JikkuJose如何在終端中啓動_twisted_?還糾正扭曲的鏈接[在這裏](http://twistedmatrix.com)。 –