本文介绍了如何在http响应中使用Content_type,video / mp2t?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在准备响应发送视频和接收错误的http请求:Broken pipe

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

我怀疑它与mimetype有关问题。任何人都可以建议我如何使用video / mp2t与baseHttpServer ??

I suspect it is related to mimetype issue. Can any one suggest me how can i use video/mp2t with baseHttpServer ??

推荐答案

在mpeg2ts,客户端(Quicktime)的上下文中在浏览器中)请求多个GET请求中的特定字节范围。根据请求的字节范围准备响应解决了问题。

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.

这篇关于如何在http响应中使用Content_type,video / mp2t?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-24 22:37