开发者

how to use Content_type, video/mp2t in http response?

I am preparing response to a http request to send video and receiving error: Broken Pipe

 if self.path.endswith(".ts"):  
     f = open("filename.ts", 'r')
     self.send_response(200)
     self.send_header('Content-Type', "video/mp2t")
     self.end_headers()
     self.wfile.write(f.read())
     return

Same response below works fine.

 if self.path.endswith(".mov"):  
            f = open("filename.mov", 'r')
            self.send_response(200)
            self.send_header('Content-Type', "video/mpeg")
            self.end_headers()
            self.wfile.write(f.read())
            return

I suspect it is related to mimetype issue. Can any one suggest me how can i use video/mp2t with baseHttpSe开发者_开发技巧rver ??


Alright, I'll give it a try. "Broken pipe" on the server side usually means that the client closes the connection while the server is still sending data. From your previous question, I assume your client is a browser (using the <video> tag). That most probably means that the browser does not support playback of MPEG transport streams. Actually I haven't heard of any browser that supports it.

Maybe you should try to stream an Ogg Theora video (MIME type "video/theora") for testing - Firefox 3.1+ supports this out of the box. If that works, your server implementation is correct.


In the context of mpeg2ts, client(Quicktime in Browser) requesting specific byte ranges in multiple GET requests. preparing the response as per the requested byte ranges fixed the issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜