Index: Source/core/html/HTMLMediaElement.cpp |
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
index 5558692f2650d0baa1f5ee8941d302f798161f0d..563692abf2ce4bbd6df11920999f4bc584200f6f 100644 |
--- a/Source/core/html/HTMLMediaElement.cpp |
+++ b/Source/core/html/HTMLMediaElement.cpp |
@@ -375,6 +375,15 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
setHasCustomStyleCallbacks(); |
addElementToDocumentMap(this, &document); |
+ |
+#if OS(ANDROID) |
+ // The OS setting for closed captions state is only available on Android, iOS |
+ // and OSX. Set closed captions visibility based on OS text tracks state only if the platform |
+ // is Android because the setting is currently only plumbed down on Android. |
+ Settings* settings = document.settings(); |
+ if (settings) |
+ m_closedCaptionsVisible = settings->textTracksEnabled(); |
+#endif |
} |
HTMLMediaElement::~HTMLMediaElement() |
@@ -3397,7 +3406,16 @@ void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu |
return; |
} |
m_haveVisibleTextTrack = haveVisibleTextTrack; |
+ |
+#if !OS(ANDROID) |
m_closedCaptionsVisible = m_haveVisibleTextTrack; |
+#else |
+ // Set closed captions visible during initial load only if the video has a |
+ // visible text track and when the android platform closed captions are enabled. |
+ Settings* settings = document().settings(); |
+ if (settings) |
+ m_closedCaptionsVisible = m_haveVisibleTextTrack && settings->textTracksEnabled(); |
+#endif |
if (!m_haveVisibleTextTrack && !mediaControls()) |
return; |