From 2bf66b8340c79b18b0cb1169e1ec092e858f5084 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 9 May 2025 16:40:19 +0200 Subject: [PATCH] Editorial: use named variables for media-resource-specific text tracks --- source | 131 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 73 insertions(+), 58 deletions(-) diff --git a/source b/source index eebe3e57f49..0b273b8ddb3 100644 --- a/source +++ b/source @@ -37461,7 +37461,8 @@ interface MediaError {

If the media data is CORS-same-origin, run the steps to - expose a media-resource-specific text track with the relevant data.

+ expose a media-resource-specific text track with the relevant data, + the media resource and the media element.

Cross-origin videos do not expose their subtitles, since that would allow attacks such as hostile sites reading subtitles from confidential videos on a user's @@ -39912,104 +39913,119 @@ interface VideoTrack { some legacy formats can be found in Sourcing In-band Media Resource Tracks from Media Containers into HTML. INBAND

-

When a media resource contains data that the user agent recognizes and supports as - being equivalent to a text track, the user agent runs the steps to expose a - media-resource-specific text track with the relevant data, as follows.

+

When a media resource contains data that the user agent recognizes + and supports as being equivalent to a text track, the user agent runs the steps to expose a + media-resource-specific text track with the relevant data.

+ +

The steps to expose a media-resource-specific text track given + some relevant data data, + a media element element, and + a media resource resource are:

    -
  1. Associate the relevant data with a new text track and its corresponding new - TextTrack object. The text track is a media-resource-specific - text track.

  2. +
  3. +

    Let track be a new text track.

    + +

    This implicitly creates a corresponding new TextTrack object.

    +
  4. + +
  5. Mark track as being a media-resource-specific text track.

  6. -
  7. Set the new text track's kind,

    Associate data with track.

  8. + +
  9. Set track's kind, label, and language - based on the semantics of the relevant data, as defined by the relevant specification. If there - is no label in that data, then the label must be set to the - empty string.

  10. + based on the semantics of data, as defined by the relevant specification. If there + is no label in data, then set track's + label to the empty string.

    -
  11. Associate the text track list of cues with the rules for updating the - text track rendering appropriate for the format in question.

    +
  12. Set track's list of cues's + rules for updating the text track rendering to the rules appropriate for the format + in question.

  13. -

    If the new text track's kind is If track's kind is chapters or metadata, then set the text track in-band - metadata track dispatch type as follows, based on the type of the media - resource:

    + data-x="dom-TextTrack-kind-metadata">metadata, then set track's in-band metadata track dispatch + type as follows, based on the type of resource:

    -
    If the media resource is an Ogg file
    +
    If resource is an Ogg file
    -
    The text track in-band metadata track dispatch type must be set to the value - of the Name header field. OGGSKELETONHEADERS
    +
    Set track's in-band metadata track dispatch type to the value of the Name header field. + OGGSKELETONHEADERS
    -
    If the media resource is a WebM file
    +
    If resource is a WebM file
    -
    The text track in-band metadata track dispatch type must be set to the value - of the CodecID element. WEBMCG
    +
    Set track's in-band metadata track dispatch type to the value of the + CodecID element. WEBMCG
    -
    If the media resource is an MPEG-2 file
    +
    If resource is an MPEG-2 file
    Let stream type be the value of the "stream_type" field describing the text track's type in the file's program map section, interpreted as an 8-bit unsigned integer. Let length be the value of the "ES_info_length" field for the track in the same part of the program map section, interpreted as an integer as defined by Generic coding of moving pictures and associated audio information. Let descriptor bytes be the - length bytes following the "ES_info_length" field. The text track in-band - metadata track dispatch type must be set to the concatenation of the stream - type byte and the zero or more descriptor bytes bytes, expressed in - hexadecimal using ASCII upper hex digits. - MPEG2 -
    + length bytes following the "ES_info_length" field. Set track's + in-band metadata track dispatch + type to the concatenation of the stream type byte and the zero or more + descriptor bytes bytes, expressed in hexadecimal using + ASCII upper hex digits. MPEG2
-
If the media resource is an MPEG-4 file
+
If resource is an MPEG-4 file
Let the first stsd box of the first stbl box of the first minf box of the - first mdia box of the - text track's trak box in the + first mdia box of + track's trak box in the first moov box of the file be the stsd box, if any. If the file has no stsd box, or if the stsd box has neither a mett box nor a metx box, then the text track - in-band metadata track dispatch type must be set to the empty string. + data-x="">mett box nor a metx box, then set track's + in-band metadata track dispatch + type to the empty string. - Otherwise, if the stsd box has a mett box then the text - track in-band metadata track dispatch type must be set to the concatenation of the - string "mett", a U+0020 SPACE character, and the value of the first mime_format field of the first mett box of the stsd - box, or the empty string if that field is absent in that box. + Otherwise, if the stsd box has a mett box then set + track's in-band + metadata track dispatch type to the concatenation of the string + "mett", a U+0020 SPACE character, and the value of the first + mime_format field of the first mett box of the + stsd box, or the empty string if that field is absent in that box. Otherwise, if the stsd box has no mett box but has a metx box then the text track in-band metadata track dispatch type - must be set to the concatenation of the string "metx", a U+0020 SPACE - character, and the value of the first namespace field of the first metx box of the stsd box, or the empty string if that field is absent in - that box. + data-x="">metx box then set track's in-band metadata track dispatch type to the concatenation of the + string "metx", a U+0020 SPACE character, and the value of the first + namespace field of the first metx box of the + stsd box, or the empty string if that field is absent in that box. MPEG4
-
  • Populate the new text track's list of - cues with the cues parsed so far, following the guidelines for exposing - cues, and begin updating it dynamically as necessary.

  • +
  • Populate track's list of cues + with the cues parsed so far, following the guidelines for exposing cues, and begin + updating it dynamically as necessary.

  • -
  • Set the new text track's readiness - state to loaded.

  • -
  • Set the new text track's mode to the - mode consistent with the user's preferences and the requirements of the relevant specification - for the data.

    +
  • +

    Set track's mode to the mode consistent + with the user's preferences and the requirements of the relevant specification for the data.

    For instance, if there are no other active subtitles, and this is a forced subtitle track (a subtitle track giving subtitles in the audio track's primary language, but @@ -40017,14 +40033,13 @@ interface VideoTrack { here.

  • -
  • Add the new text track to the media element's list of text - tracks.

  • +
  • Add track to element's list of text tracks.

  • Fire an event named addtrack at the media element's addtrack at element's textTracks attribute's TextTrackList object, using TrackEvent, with the track - attribute initialized to the text track's TextTrack object.

  • + attribute initialized to track's TextTrack object.