docs: clarify HTMLMediaElement abort event example#44227
Conversation
5efa2a4 to
83b8ec5
Compare
|
Preview URLs (1 page) |
hamishwillee
left a comment
There was a problem hiding this comment.
Thanks @HeisenPat
This is obviously much better, but
-
Can we modify to a more common approach, which is to use a button. Something "like" this, but with the comment that this would only fire if the video was still downloading.
const video = document.querySelector('video'); const stopButton = document.querySelector('#stopBtn'); stopButton.addEventListener('click', () => { // 1. Remove the source to force the browser to give up fetching video.removeAttribute('src'); // 2. Invoke load() to trigger the resource selection/abort algorithms video.load(); });
-
In the introduction it says
The abort event is fired when the resource was not fully loaded, but not as the result of an error.
We could be more clear about the intent
The abort event is fired when media resource loading is stopped by a user before completion.
This is useually achieved by removing the
srcattribute or setting it to the empty string (""), then callingload().
FWIW Generally it is worth selecting issues that don't have the "needs triage" label on them - once triaged they are more likely to be valid, and there are often better comments on what might be an acceptable fix.
Very happy with this to be fixed of course, as it is a bug.
|
Thanks @hamishwillee, I updated the example to use a button, remove the src attribute, and call load(). I also clarified the intro text as suggested. |
hamishwillee
left a comment
There was a problem hiding this comment.
Thanks @HeisenPat
Another developer had a shot at this in #44280
One thing @chrisdavidmills pointed out is that the example in that #44280 (review) didn't behave as expected. So::
- It would be beneficial to copy the approach there and make a live example.
- Test it.
O
Summary
Related issue
Fixes #44222
Testing