Closed Bug 977302 Opened 11 years ago Closed 11 years ago

[webvtt] Perform automatic text track selection whenever a text track is added to a media element

Categories

(Core :: Audio/Video, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: reyre, Assigned: reyre)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file, 3 obsolete files)

This consists of a number of steps including honoring the user preferences for automatic text track selection: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#honor-user-preferences-for-automatic-text-track-selection.
QA Contact: rick.eyre
Blocks: 977299
Assignee: nobody → rick.eyre
QA Contact: rick.eyre
Depends on: 882664
I still have to update the TODO line with the appropriate bug number. I'll file a bug and fill it in once this gets reviewed.
Attachment #8384071 - Flags: review?(giles)
Comment on attachment 8384071 [details] [diff] [review] v1: Perform automatic text track selection r=rillian. Review of attachment 8384071 [details] [diff] [review]: ----------------------------------------------------------------- r=me with comments addressed. Sorry I took so long to get back to you. ::: content/html/content/src/TextTrackManager.cpp @@ +242,5 @@ > + > + TextTrackKind ttKinds[] = { TextTrackKind::Captions, > + TextTrackKind::Subtitles }; > + > + PerformTrackSelection(ttKinds, 2); Please use 'ArrayLength(ttKinds)' instead of a literal '2' here. @@ +271,5 @@ > +void > +TextTrackManager::PerformTrackSelection(TextTrackKind aTextTrackKind) > +{ > + TextTrackKind ttKinds[] = { aTextTrackKind }; > + PerformTrackSelection(ttKinds, 1); ArrayLength(ttKinds) @@ +278,5 @@ > +void > +TextTrackManager::PerformTrackSelection(TextTrackKind aTextTrackKinds[], > + uint32_t size) > +{ > + nsTArray<TextTrack*> textTracks; Might be more clear to call this variable 'candidates' to match the spec. @@ +280,5 @@ > + uint32_t size) > +{ > + nsTArray<TextTrack*> textTracks; > + GetTextTracksOfKinds(aTextTrackKinds, size, textTracks); > + Did you leave out step 3, "If any of the text tracks in candidates have a text track mode set to showing, abort these steps" here? @@ +281,5 @@ > +{ > + nsTArray<TextTrack*> textTracks; > + GetTextTracksOfKinds(aTextTrackKinds, size, textTracks); > + > + // TODO: Bug XXX - Honor user preferences for text track selection. Please do set a bug number here before landing. ::: content/media/test/test_texttrack.html @@ +96,5 @@ > + { label: "fourth", mode: "hidden"} > + ]; > + is(video.textTracks.length, trackData.length, "TextTracks length should be " + trackData.length); > + for (var i = 0; i < trackData.length; i++) { > + var track = video.textTracks[i]; You can use 'let' instead of 'var' for things like this, btw. Mochitests only run in FF so newer js is fine.
Attachment #8384071 - Flags: review?(giles) → review+
Thanks for review Ralph. (In reply to Ralph Giles (:rillian) from comment #2) > Please use 'ArrayLength(ttKinds)' instead of a literal '2' here. Fixed. > + nsTArray<TextTrack*> textTracks; > > Might be more clear to call this variable 'candidates' to match the spec. Updated. > Did you leave out step 3, "If any of the text tracks in candidates have a > text track mode set to showing, abort these steps" here? Ah, yes, I did. Good catch. I've updated it. > Please do set a bug number here before landing. Filed as bug 981691. > You can use 'let' instead of 'var' for things like this, btw. Mochitests > only run in FF so newer js is fine. For some reason it didn't like it when I changed to use 'let' for the 'track' variable. Complained about a missing semi-colon.
Attachment #8384071 - Attachment is obsolete: true
Attachment #8388848 - Flags: review?(giles)
Comment on attachment 8388848 [details] [diff] [review] v2: Perform automatic text track selection r=rillian. Review of attachment 8388848 [details] [diff] [review]: ----------------------------------------------------------------- r=me with comment addressed. ::: content/html/content/src/TextTrackManager.cpp @@ +296,5 @@ > + // Step 4: Honor user preferences for track selection, otherwise, set the > + // first TextTrack in candidates with a default attribute to showing. > + // TODO: Bug 981691 - Honor user preferences for text track selection. > + for (uint32_t i = 0; i < candidates.Length(); i++) { > + if (TrackIsDefault(candidates[i])) { I believe you need to also check 'candidates[i]->GetMode() == TextTrackMode::Disabled' here.
Attachment #8388848 - Flags: review?(giles) → review+
Depends on: 983207
Just a rebase. Carrying forward r=rillian.
Attachment #8388848 - Attachment is obsolete: true
Please land bug 983293 before this one.
Doesn't apply to inbound. Please rebase.
Keywords: checkin-needed
Sorry Ryan. Rebased so that landing on top of bug 983293 will work. Carrying forward r=rillian.
Keywords: checkin-needed
Attachment #8393508 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: