是否可以移动< video> DOM中的元素不重设呢? [英] Is it possible to move a <video> element in the DOM without resetting it?

查看:110
本文介绍了是否可以移动< video> DOM中的元素不重设呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的DOM中创建一个< video> 元素,然后将其移动到另一个位置,而不会中断该内容的播放。 >

也许更广泛地说,是否可以移动任何 DOM元素,而不会中断附加的事件?



一些方法包括使用CSS绝对定位,但是有没有办法以不中断播放的方式实际更新DOM?

解决方案

不幸的是DOM并没有真正的移动概念,只需要分离并重新连接。一旦DOM节点不再植根于文档中,就会丢失其播放状态。



您可能可以通过将其存储在JS中并保留它应用它,但这可能会引入一点跳过。


I'd like to create a <video> element within my DOM, and then move it to another position without interrupting the playing of that content.

Perhaps more broadly, is it possible to move any DOM element without disrupting attached events?

Some approaches include using CSS absolute positioning, but is there a way to actually update the DOM in a way that doesn't interrupt the playback?

解决方案

Unfortunately not. The DOM doesn't really have a concept of move, you just have to detach and reattach. As soon as the DOM node is no longer rooted in a document, it loses its playing state.

You may be able to preserve it somewhat by storing it in JS and re-applying it, but that will probably introduce a little skipping.

这篇关于是否可以移动&lt; video&gt; DOM中的元素不重设呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆