Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebVTT - general restructure to match normal API docs #34034

Merged
merged 14 commits into from
Jul 12, 2024

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented Jun 10, 2024

The current WebVTT docs include all information in a single doc which mixes the Web API, guide, WebVTT file format, tutorials, etc and has quite a bit of duplication.

This attempts to push the document into a more standard pattern

Note, I did not do this - cannot get Regions to work in FF in any form:

This is part of minimum work to meet minimum docs criteria for #33589

@github-actions github-actions bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Jun 10, 2024
Copy link
Contributor

github-actions bot commented Jun 10, 2024

Preview URLs (17 pages)
Flaws (21)

Note! 11 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/WebVTT_API/Web_Video_Text_Tracks_Format
Title: Web Video Text Tracks Format (WebVTT)
Flaw count: 1

  • broken_links:
    • No need for the pathname in anchor links if it's the same page

URL: /en-US/docs/Web/API/HTMLVideoElement
Title: HTMLVideoElement
Flaw count: 6

  • macros:
    • /en-US/docs/Web/API/HTMLVideoElement/mozParsedFrames does not exist
    • /en-US/docs/Web/API/HTMLVideoElement/mozDecodedFrames does not exist
    • /en-US/docs/Web/API/HTMLVideoElement/mozPresentedFrames does not exist
    • /en-US/docs/Web/API/HTMLVideoElement/mozPaintedFrames does not exist
    • /en-US/docs/Web/API/HTMLVideoElement/mozFrameDelay does not exist
    • and 1 more flaws omitted

URL: /en-US/docs/Web/API/TextTrack
Title: TextTrack
Flaw count: 1

  • macros:
    • /en-US/docs/Web/API/HTMLMediaElement/addTrack does not exist

URL: /en-US/docs/Web/API/TextTrackList
Title: TextTrackList
Flaw count: 1

  • macros:
    • /en-US/docs/Web/API/HTMLMediaElement/addTextTrack does not exist

URL: /en-US/docs/Web/API/VTTRegion
Title: VTTRegion
Flaw count: 9

  • macros:
    • /en-US/docs/Web/API/VTTRegion/VTTRegion does not exist
    • /en-US/docs/Web/API/VTTRegion/id does not exist
    • /en-US/docs/Web/API/VTTRegion/width does not exist
    • /en-US/docs/Web/API/VTTRegion/lines does not exist
    • /en-US/docs/Web/API/VTTRegion/regionAnchorX does not exist
    • and 4 more flaws omitted

URL: /en-US/docs/Web/HTML/Element/track
Title: <track>: The Embed Text Track element
Flaw count: 3

  • macros:
    • /en-US/docs/Web/API/HTMLTrackElement/track does not exist
    • /en-US/docs/Web/API/HTMLTrackElement/track does not exist
    • /en-US/docs/Web/API/HTMLMediaElement/addTrack does not exist
External URLs (2)

URL: /en-US/docs/Web/API/WebVTT_API/Web_Video_Text_Tracks_Format
Title: Web Video Text Tracks Format (WebVTT)


URL: /en-US/docs/Web/HTML/Element/track
Title: <track>: The Embed Text Track element

(comment last updated: 2024-07-12 06:39:16)

@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs Content:HTML Hypertext Markup Language docs labels Jun 11, 2024
@github-actions github-actions bot added size/xl [PR only] >1000 LoC changed and removed size/m [PR only] 51-500 LoC changed labels Jun 11, 2024
@github-actions github-actions bot added the merge conflicts 🚧 [PR only] label Jun 14, 2024
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@hamishwillee hamishwillee force-pushed the webvtt_edits branch 2 times, most recently from 1f4466d to 205ae20 Compare July 9, 2024 06:03
@hamishwillee hamishwillee marked this pull request as ready for review July 9, 2024 06:05
@hamishwillee hamishwillee requested review from a team as code owners July 9, 2024 06:05
@hamishwillee hamishwillee requested review from sideshowbarker, chrisdavidmills and pepelsbey and removed request for a team July 9, 2024 06:05
Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hamishwillee quite a few comments here, but mainly grammatical quibbles. Nothing particularly major. I know this is a restructure, but I couldn't help myself ;-)

I'm approving it so as not to hold you up.

@@ -11358,6 +11358,7 @@
/en-US/docs/Web/CSS/::-webkit-scrollbar-thumb /en-US/docs/Web/CSS/::-webkit-scrollbar
/en-US/docs/Web/CSS/::-webkit-scrollbar-track /en-US/docs/Web/CSS/::-webkit-scrollbar
/en-US/docs/Web/CSS/::-webkit-scrollbar-track-piece /en-US/docs/Web/CSS/::-webkit-scrollbar
/en-US/docs/Web/CSS/::cue-region /en-US/docs/Web/API/WebVTT_API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why you'd want to delete this, as it has no support anywhere. Estelle and I have started adding notes to spec landing pages to mention items that are specified but not supported anywhere, just in case people go "x is in the spec; why is it not documented?"

So for example:

Note: The specification defines another pseudo-element, ::cue-region, but this is not supported by any browsers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisdavidmills Is there a discussion on this? The reason I ask is that I love the idea of making it clear that things are deliberately not documented, but we should harmonize the team approach.

If it were me, we would list them (as though they were defined) in the overview page but be tagged with a macro that applies styling {{no_browser_implementation("::cue-region")}} to indicate that they aren't supported (linked to info text). This could then be added/removed by BCD possibly.

But there are many options, and maybe a note is the right one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS For now I have done as you suggested!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if there is a discussion anywhere about it. I guess you could ask Estelle. I think it is a reasonable approach for now, and there aren't so many of them that we couldn't change if something else is eventually decided.

The `TextTrack` interface—part of the API for handling WebVTT (text tracks on media presentations)—describes and controls the text track associated with a particular {{HTMLElement("track")}} element.
The `TextTrack` interface of the [WebVTT API](/en-US/docs/Web/API/WebVTT_API) represents a text track associated with a media element.

The object owns the list of {{domxref("VTTCue")}} objects that will be displayed over the video at various points.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a bit odd that this page doesn't indicate the relationship between TextTrack, <track>/HTMLTrackElement, and media elements like <video>/HTMLVideoElement; it is just implied by an example later on. Maybe add just a sentence to talk about this, e.g.

"A TextTrack can be added to a media element using the addTrack() method. This has the same effect as declaratively adding a text track via a <track> element".

Just give people an idea of how they relate, as it is confusing.

Similar comment applies to the <track>/HTMLTrackElement pages and <video>/HTMLVideoElement pages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very point. I have fixed this up a bit TextTrack, TextTrackList and <track> now properly cross link.

I added an example of using track in the video element too. It's not something that integrates well, and that video element page needs more love and testing than I am willing to give it.

That set of changes in 6952a0a

files/en-us/web/api/texttrackcue/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/texttracklist/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/texttracklist/index.md Outdated Show resolved Hide resolved
@sideshowbarker sideshowbarker removed their request for review July 9, 2024 10:14
Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>
### Detecting track addition and removal

You can detect when tracks are added to and removed from a `<video>` element using the {{domxref("VideoTrackList/addtrack_event", "addtrack")}} and {{domxref("VideoTrackList/removetrack_event", "removetrack")}} events. However, these events aren't sent directly to the `<video>` element itself. Instead, they're sent to the track list object within the `<video>` element's {{domxref("HTMLMediaElement")}} that corresponds to the type of track that was added to the element:
You can detect when tracks are added to and removed from a `<video>` element using the {{domxref("VideoTrackList/addtrack_event", "addtrack")}} and {{domxref("VideoTrackList/removetrack_event", "removetrack")}} events. However, these events aren't sent directly to the `<video>` element itself.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I found this whole thing a bit confusing because the track elements dont allow you to add anything other than text tracks to the video/audio. So it's a bit unclear how you'd add new audio tracks (for example).

@hamishwillee hamishwillee merged commit 3975bcf into mdn:main Jul 12, 2024
9 checks passed
@hamishwillee hamishwillee deleted the webvtt_edits branch July 12, 2024 06:45
@hamishwillee
Copy link
Collaborator Author

Thanks for that mammoth review @chrisdavidmills - I have taken almost all of it on board. This is much better than it was.

- {{domxref("HTMLMediaElement.videoTracks")}}
- : Add an `addtrack` listener to this {{domxref("VideoTrackList")}} object to be informed when video tracks are added to the element.
- : A {{domxref("VideoTrackList")}} containing all of the media element's audio tracks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hamishwillee I did find one small thing here — this line should say "video tracks".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed by #34832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs Content:HTML Hypertext Markup Language docs Content:WebAPI Web API docs size/xl [PR only] >1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix WebVTT description indicating that text payload lines need to start with a hyphen
2 participants