Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWIP: HTML media events and elements #81
Conversation
These media events are all nearly identical, with no special payloads, and there are a lot of them. So at least for the time being, I'm generating them all using a macro.
We add some basic support for <audio> and <video> elements, but many attributes have been omitted.
|
For now this is looking pretty nice! Thanks for the great work! One extra thing I'd like to request - in places you can please add links to the specs (as normal comments, not doc comments). In the next few weeks I'm planning to go through the whole
You can run them with |
| /// | ||
| /// [(JavaScript docs)](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState) | ||
| #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] | ||
| pub enum ReadyState { |
koute
Jan 15, 2018
Owner
ReadyState -> MediaReadyState maybe? (We have way to many ReadyStates, so I'd like them to all have unique names to reduce confusion.)
ReadyState -> MediaReadyState maybe? (We have way to many ReadyStates, so I'd like them to all have unique names to reduce confusion.)
emk
Jan 15, 2018
Author
Great idea! I'll rename it.
Great idea! I'll rename it.
|
Thank you for your feedback!
I've tried to add doc comments to MDN wherever MDN has actual docs. (I omitted some of the individual attribute links for Do you have any examples of the kind of comment that you'd like me to add? Do you have any preferences for a particular version of the HTML spec that I should link to? I think I can provide at least partial test coverage without async tests. |
Yep! Those are mostly for the users.
You can just put a link to the specs as a normal These are only meant to be for us so it doesn't really matter how exactly it'll look like; it's just nice for it to be there so that when reading the code one can check how it's supposed to behave without having to search for the specs manually. You can link to the newest version as long as it's official. |
Not yet ready to merge! I'm working on implementing #62. However, I would be very interested in feedback about how I can make this code fit nicely into stdweb without causing any headaches for the maintainers.
Progress:
IHTMLMediaElementtrait. This is shared between<audio>and<video>. I've implemented a handful of the most important attributes and methods, but there are plenty more that could be added. Right now, I put this in thehtml_elementsnamespace, along with a supportingReadyStatetype, but maybe this should live elsewhere?AudioElementandVideoElementstructs. These are just implementations ofIHTMLMediaElement, and they shoudn't need any logic of their own, as far as I know.stdwebtesting yet, but I need to look at it before I go further.IHTMLMediaElementattributes and methods?Anyway, thank you for your encouragement, and please let me know if you have any suggestions!