简体   繁体   English

通过http从mjpeg流中提取其他数据

[英]Extracting other data from an mjpeg stream via http

I'm getting an mjpeg stream via http and viewing it using the <img> tag. 我通过http获取mjpeg流并使用<img>标签查看它。 Pretty standard and no problem there, everything is streaming correctly. 非常标准,没有问题,一切都正确流。

However, along with the encoded jpg data there's a UTC timestamp in the http response that I'd like to access. 但是,与编码的jpg数据一起,http响应中有一个我想要访问的UTC时间戳。 Basically, I'd like to be able to display the matching time with each frame. 基本上,我希望能够显示每帧的匹配时间。 Here's the response I'm working with for each frame that comes through: 以下是我正在使用的每个框架的响应:

Content-Type: image/jpeg
Content-Length: 60189
Time-Stamp: 51961243969
UTC-Time: 1349439599864
Flags: 2097153
PlayID: 1
Camera-Type: Halocam IP
Connection: Close

[encoded jpg data]
--myboundary

Currently the <img> tag is taking that stream and interpreting the jpgs directly. 目前,<img>标签正在获取该流并直接解释jpgs。 Is there anyway to intercept, interpret or separate the UTC-Time value via javascript so I could display it on the page? 无论如何通过javascript拦截,解释或分离UTC时间值,以便我可以在页面上显示它? I don't control the http response, but if a solution were available via some change there, I could talk to the person who does control it. 我不控制http响应,但如果通过某些更改可以获得解决方案,我可以与控制它的人交谈。

使用XMLHttpRequest,然后提取其所有响应头

example with jquery: 使用jquery的示例:

$.ajax({url:'a.jpg', 
        complete: function(r){
              console.log(r.getAllResponseHeaders());
        }
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM