2013-08-03 31 views
8

Tôi chia sẻ tệp trong một thư mục với các thiết bị khác bằng cách gọi một máy chủ sử dụng python -m SimpleHTTPServer.Phát âm thanh/Video không thành công bằng SimpleHTTPServer

Tôi chỉ cố gắng để stream video/audio (tiêu chuẩn mp4 & mp3, cả dưới 20MB) để máy tính khác sử dụng & này nó TRÌNH (nhưng bằng cách ném các lỗi (niêm yết xuống) tại nhà ga).

Bằng cách nào đó, video/âm thanh bị lỗi (ngoại trừ các tệp mp3 rất nhỏ) để phát bằng Safari trong iPhone/iPad. Nó chắc chắn không liên quan đến các tập tin media, khi tôi truyền chúng thành công bằng cách sử dụng Apache trong iPhone.

Bất kỳ ý tưởng nào tại sao nó xảy ra?

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

Xem các [lựa chọn thay thế] này (http://stackoverflow.com/questions/12905426/faster-alternative-to-pythons-simplehttpserver) với mô-đun SimpleHTTPServer của Python. – mtadd

Trả lời

6

Như sugested một trong hai lựa chọn thay thế python sử dụng, What is a faster alternative to Python's http.server (or SimpleHTTPServer)? hoặc sử dụng đầy đủ thổi Serwer web hoàn toàn. Quick google gợi ý rằng Mac hỗ trợ cả Nignx và Apache2.

+2

Cảm ơn bạn đã liên kết đến các lựa chọn thay thế nhưng [đánh dấu câu trả lời] (http://stackoverflow.com/a/12905427/2602869) đề xuất [http-server] (https://github.com/nodeapps/http-server) (đối với node.js) dường như không phát các tệp video. Nhưng, [twistd] (http: // http: //twistedmatrix.com) (cho Python) như được giải thích trong [câu trả lời khác] (http://stackoverflow.com/a/14618010/2602869) hiện nó khá tốt! –

+0

@JikkuJose làm thế nào tôi có thể bắt đầu _twisted_ trong thiết bị đầu cuối? Cũng đúng liên kết của xoắn [là ở đây] (http://twistedmatrix.com). –

Các vấn đề liên quan