Index: Source/core/html/HTMLMediaElement.cpp |
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
index 55fe318b23eea679d5f2c41fd8234f17eb74664d..ea4113d068cd8584f5c16240c5bfd92e5ecc7c68 100644 |
--- a/Source/core/html/HTMLMediaElement.cpp |
+++ b/Source/core/html/HTMLMediaElement.cpp |
@@ -2924,6 +2924,25 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) |
trackToEnable->setMode(TextTrack::showingKeyword()); |
} |
+void HTMLMediaElement::configureMetadataTextTrackGroup(const TrackGroup& group) |
+{ |
+ ASSERT(group.tracks.size()); |
+ |
+ // https://html.spec.whatwg.org/multipage/embedded-content.html#honor-user-preferences-for-automatic-text-track-selection |
+ |
+ // 4. If there are any text tracks in the media element's list of text |
+ // tracks whose text track kind is metadata that correspond to track |
+ // elements with a default attribute set whose text track mode is set to |
+ // disabled, then set the text track mode of all such tracks to hidden |
+ for (auto& textTrack : group.tracks) { |
+ if (textTrack->mode() != TextTrack::disabledKeyword()) |
+ continue; |
+ if (!textTrack->isDefault()) |
+ continue; |
+ textTrack->setMode(TextTrack::hiddenKeyword()); |
+ } |
+} |
+ |
void HTMLMediaElement::configureTextTracks() |
{ |
TrackGroup captionAndSubtitleTracks(TrackGroup::CaptionsAndSubtitles); |
@@ -2979,7 +2998,7 @@ void HTMLMediaElement::configureTextTracks() |
if (chapterTracks.tracks.size()) |
configureTextTrackGroup(chapterTracks); |
if (metadataTracks.tracks.size()) |
- configureTextTrackGroup(metadataTracks); |
+ configureMetadataTextTrackGroup(metadataTracks); |
if (otherTracks.tracks.size()) |
configureTextTrackGroup(otherTracks); |
philipj_slow
2015/01/29 10:34:52
This looks like it's not per spec if you want to r
fs
2015/01/29 12:05:51
Yes, I noticed this as well, and I wondered what t
|