删除html5媒体元素是否也会删除视频/音频使用的内存? [英] Does removing html5 media elements also remove memory used by the video/audio?

查看:609
本文介绍了删除html5媒体元素是否也会删除视频/音频使用的内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

删除html5媒体DOM元素(视频或音频)是否还释放该元素所代表的媒体使用的所有内存? (假设代码中没有引用)

Does removing an html5 media DOM element (video or audio) also free any memory used by the media represented by that element? (assuming no references in code also)

推荐答案

从规范:

4.8.10.16使用媒体元素的作者的最佳做法

在小型设备(如机顶盒或移动设备)上播放音频和视频资源电话通常受到设备中有限硬件资源的限制。例如,设备可能仅支持三个同步视频。出于这个原因,释放媒体元素在播放时所拥有的资源是一个很好的做法,要么非常小心 删除对元素的所有引用并允许它垃圾收集 ,或者更好的是, 删除元素的src属性和任何源元素后代,并调用元素的load()方法

Playing audio and video resources on small devices such as set-top boxes or mobile phones is often constrained by limited hardware resources in the device. For example, a device might only support three simultaneous videos. For this reason, it is a good practice to release resources held by media elements when they are done playing, either by being very careful about removing all references to the element and allowing it to be garbage collected, or, even better, by removing the element's src attribute and any source element descendants, and invoking the element's load() method.

同样,当播放速率不是1.0时,硬件,软件或格式限制可能会导致视频帧丢失,音频不稳定或静音。

Similarly, when the playback rate is not exactly 1.0, hardware, software, or format limitations can cause video frames to be dropped and audio to be choppy or muted.

来源: http://dev.w3.org/html5/spec-author-view/video.html#media-resource

这篇关于删除html5媒体元素是否也会删除视频/音频使用的内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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