Skip to content

Commit

Permalink
Fix best practice advice for freeing media element resources
Browse files Browse the repository at this point in the history
This came up in the context of https://bugs.chromium.org/p/chromium/issues/detail?id=1144736#c72.

Per spec, removing the src attribute does not release resources, so the best practices section shouldn't suggest doing so. See https://html.spec.whatwg.org/multipage/media.html#location-of-the-media-resource.
  • Loading branch information
dalecurtis committed Aug 3, 2021
1 parent 53bc380 commit 2fd656e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source
Expand Up @@ -39120,9 +39120,9 @@ dictionary <dfn dictionary>TrackEventInit</dfn> : <span>EventInit</span> {
support three simultaneous videos. For this reason, it is a good practice to release resources
held by <span data-x="media element">media elements</span> 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 <code data-x="attr-media-src">src</code>
attribute and any <code>source</code> element descendants, and invoking the element's <code
data-x="dom-media-load">load()</code> method.</p>
collected, or, even better, by setting the element's <code data-x="attr-media-src">src</code>
attribute to an empty string. In cases where <code data-x="dom-media-srcObject">srcObject</code>
was set, instead set the <code data-x="dom-media-srcObject">srcObject</code> to null.</p>

<p>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.</p>
Expand Down

0 comments on commit 2fd656e

Please sign in to comment.