Sprints: Refactor media events

Created on 6 Feb 2019  路  7Comments  路  Source: mdn/sprints

This is a work item for #685.

HTMLMediaElement Events

For HTMLMediaElement pages:

Add links to all events from:

Acceptance Criteria:

All check boxes checked for being either: done, won't fix, or put into new tasks.

Most helpful comment

Thanks for bringing this up, @SphinxKnight :+1:

You're on point here, the move was supposed to go to the Web/API/ tree not the Web/HTML/ tree.
For determining the target interface where to put this, I'm double-checking with the specs as these old MDN event docs can be wrong. I think the relevant spec for media events is this one: https://html.spec.whatwg.org/multipage/media.html#mediaevents and there it says "The following events fire on media elements" which refers to https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement

So, https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playing_event would be correct here, I believe.

Does all this make sense to you, @estelle?

All 7 comments

I'm taking the liberty to report here, please let me know if this irrelevant/wrong.
Regarding the playing event, there are now 3 pages under the HTML:

Moreover, if I correctly understood Will's procedure and the target of this event, those pages should be located under
https://developer.mozilla.org/en-US/docs/Web/API/Element (or https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement if the rule is not to be taken literally).

I understand time's a finite resource for everyone and that this just occurred yesterday and may perfectly be a temporary situation, however I would be grateful if such a work in progress could be flagged on the page (e.g. using the {{Draft}} macro or any similar tag/macro).

Thanks a lot in advance and "bon courage" with all this work of refactoring :)

Thanks for bringing this up, @SphinxKnight :+1:

You're on point here, the move was supposed to go to the Web/API/ tree not the Web/HTML/ tree.
For determining the target interface where to put this, I'm double-checking with the specs as these old MDN event docs can be wrong. I think the relevant spec for media events is this one: https://html.spec.whatwg.org/multipage/media.html#mediaevents and there it says "The following events fire on media elements" which refers to https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement

So, https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/playing_event would be correct here, I believe.

Does all this make sense to you, @estelle?

The triplicate issue should not have happened, but my understading is that these events are event on the HTML Media elements of

https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events are the events.

The listeners are written as:

var vid1 = document.getElementsByTagName("video")[0];
vid1.addEventListener("seeked", function() { console.log('seeked'); });
vid1.addEventListener("canplaythrough", function(evt) {console.log(evt);})
vid1.currentTime = 5;

or

// not the right way, and not adding this to MDN
var vid1 = document.getElementsByTagName("video")[0];
vid1.onseeked = function() { console.log('seeked'); });
vid1.oncanplaythrough = function(evt) {console.log(evt);})
vid1.currentTime = 10.0;

Web authors are going to use the code similar to
myMedia[0].addEventListener(event, functionname);

where
myMedia = document.querySelectorAll('video, audio'); or something similar - using video and audio, not HTMLMediaElement

therefore the events listed in the ticket (with the exception of audioprocess and complete) should be attached to both video and audio, and HTMLMediaElement as well. But will be more helpful to developers under each element, with examples for that element.

The <video> and <audio> pages link to https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement and https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement respectively, which state the inheritance from HTMLMediaElement and HTMLElement. So it is definitely there, and I see posting it all under media element, but we need to also post under both video and audio, and under HTMLVideoElement and HTMLAudioElement, in some form, because that is too far of a stretch for devs to locate the events available on video and audio.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/canplay_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/canplaythrough_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/durationchange_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/emptied_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/ended_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/loadeddata_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/loadedmetadata_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/pause_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/play_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/playing_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/ratechange_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/seeked_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/seeking_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/stalled_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/suspend_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/timeupdate_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/volumechange_event

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video/waiting_event

@estelle Let's just back up a second and check in with what you are doing. I'm only saying this because from our conversation last night, it sounded like we were saying that you'd put duplicates of each event page hanging off HTMLVideoElement and HTMLAudioElement, so e.g.

But it looks like you are putting them on HTMLMediaElement, e.g.

This is actually OK, because HTMLMediaElement is not a mixin, but rather an inherited interface (my mistake, sorry about that).

I would say that you should add something prominent to the HTMLAudioElement and HTMLVideoElement pages making it clear that these events are available on those interfaces. Either a link to the events section on HTMLMediaElement page, or even repeating the whole section.

You should definitely also make sure they are linked from the

There don't appear to be any specialist events defined on HTMLAudioElement and HTMLVideoElement, which simplifies things somewhat. You do need to create pages for the EME-specific events, see https://dxr.mozilla.org/mozilla-central/source/dom/webidl/HTMLMediaElement.webidl#156.

Another thing to think about is that, while the spec doesn't officially define on... event handler properties for these events, they do exist. So we probably need pages for each of these too.

And I've also noticed that each of the event pages will be a lot of work, because they are done in an old style and need updating to the new style we agreed on (see https://developer.mozilla.org/en-US/docs/Web/API/Window/vrdisplayactivate_event as an example).

In short, this is a huge amount of work, and I feel kinda guilty dumping this one on you ;-)

I have some time on Monday/Tuesday next week and would like to offer to help you get some of these done. Let me know where you've got to by the end of your work time this week, and I can jump on board and dig into some of these if needed.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/canplay_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/canplaythrough_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/durationchange_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/emptied_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/ended_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/loadeddata_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/loadedmetadata_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/pause_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/play_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/playing_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/ratechange_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/seeked_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/seeking_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/stalled_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/suspend_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/timeupdate_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/volumechange_event

  • [X] - Deleted
  • [X] - International Deleted

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio/waiting_event

  • [X] - Deleted
  • [X] - International Deleted
Was this page helpful?
0 / 5 - 0 ratings

Related issues

wbamberg picture wbamberg  路  5Comments

chrisdavidmills picture chrisdavidmills  路  6Comments

ddbeck picture ddbeck  路  4Comments

Elchi3 picture Elchi3  路  8Comments

cheeZery picture cheeZery  路  7Comments