创建两个 使用一个 MotionJPEG 流时的元素
我正在尝试制作一个显示多个 MotionJPEG 图像缩略图的页面。单击缩略图时,其内容也会显示在更大的图像元素中。
问题是,当我尝试对缩略图和主视图使用相同的 MotionJPEG 流(设置主图像的 src 属性)时,数据永远不会到达。据我了解,我流式传输的服务仅允许将同一图像流式传输到单个 IP 一次,即只要第一个请求仍在运行,所有后续 HTTP 请求都不会返回。
我可以做些什么来解决这个问题?我可以使用一个 JavaScript Image 对象将其同时附加到两个 DOM 节点吗?
I'm trying to make a page that would display several MotionJPEG image thumbnails. When a thumbnail is clicked, its contents are shown in a larger image element as well.
The problem is that when I try to use the same MotionJPEG stream for both a thumbnail and the main view (setting the main image's src attribute), the data never arrives. As far as I understand, the service I stream from only allows streaming the same image to a single IP once, i.e all subsequent HTTP requests do not return as long as the first one is still running.
What can I do to work around this? Can I use one JavaScript Image object to e.g. attach it to two DOM nodes simultaneously?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不可以。一个节点只能有一个父节点。将其附加到新的父级会将其从旧的父级中删除。
使用 CSS
background-image
将相同的背景图像应用于两个元素怎么样?我这里没有任何 MJPEG-over-HTTP 网络摄像头来测试它,但可能multipart/x-mixed-replace
在这里不起作用。不幸的是,要使一个背景成为缩略图,您必须使用 CSS3 < code>background-size,仅受最新浏览器(不支持 IE<9)支持,并且通常带有供应商前缀。话又说回来,我相信
multipart/x-mixed-replace
无论如何在 IE 中都不起作用。No. A node may only have one parent. Appending it to a new parent removes it from the old.
How about applying the same background image to two elements, using CSS
background-image
? I don't have any MJPEG-over-HTTP webcam here to test it on, though, it might be thatmultipart/x-mixed-replace
doesn't work here.Unfortunately for one background to be a thumbnail you would have to use CSS3
background-size
, which is only supported by the latest browsers (not IE<9) and then often with vendor-prefixes. Then again, I believemultipart/x-mixed-replace
doesn't work in IE anyway.