Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 291163004: Implement media cast buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tidy up button name Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 86ec6ffd1cbf01b7fa3a9448b3b356fe1b01e574..858f37d98c0f35f81bfc83fabb2b999a823680b5 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -354,6 +354,8 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
, m_tracksAreReady(true)
, m_haveVisibleTextTrack(false)
, m_processingPreferenceChange(false)
+ , m_remoteRoutesAvailable(false)
+ , m_casting(false)
#if ENABLE(OILPAN)
, m_isFinalizing(false)
, m_closeMediaSourceWhenFinalizing(false)
@@ -2278,6 +2280,20 @@ void HTMLMediaElement::pause()
updatePlayState();
}
+void HTMLMediaElement::requestRemotePlayback()
+{
+ if (!m_player)
+ return;
+ m_player->requestRemotePlayback();
acolwell GONE FROM CHROMIUM 2014/08/05 19:36:34 Use webMediaPlayer() here and below.
acolwell GONE FROM CHROMIUM 2014/08/05 19:36:34 ASSERT(m_remoteRoutesAvailable) here and below so
aberent 2014/08/22 14:08:33 Done.
aberent 2014/08/22 14:08:33 Done.
+}
+
+void HTMLMediaElement::requestRemotePlaybackControl()
+{
+ if (!m_player)
+ return;
+ m_player->requestRemotePlaybackControl();
+}
+
void HTMLMediaElement::closeMediaSource()
{
if (!m_mediaSource)
@@ -3167,6 +3183,27 @@ void HTMLMediaElement::mediaPlayerRequestSeek(double time)
setCurrentTime(time, IGNORE_EXCEPTION);
}
+void HTMLMediaElement::mediaPlayerRemoteRouteAvailabilityChanged(bool routesAvailable)
+{
+ m_remoteRoutesAvailable = routesAvailable;
+ if (hasMediaControls())
+ mediaControls()->refreshCastButtonVisibility();
+}
+
+void HTMLMediaElement::mediaPlayerConnectedToRemoteDevice()
+{
+ m_casting = true;
+ if (hasMediaControls())
+ mediaControls()->startedCasting();
+}
+
+void HTMLMediaElement::mediaPlayerDisconnectedFromRemoteDevice()
+{
+ m_casting = false;
+ if (hasMediaControls())
+ mediaControls()->stoppedCasting();
+}
+
// MediaPlayerPresentation methods
void HTMLMediaElement::mediaPlayerRepaint()
{
@@ -3642,7 +3679,7 @@ bool HTMLMediaElement::createMediaControls()
void HTMLMediaElement::configureMediaControls()
{
- if (!shouldShowControls() || !inDocument()) {
acolwell GONE FROM CHROMIUM 2014/08/05 19:36:34 Doesn't removing this end up causing the controls
aberent 2014/08/22 14:08:33 The problem I have is that I need the overlay cast
+ if (!inDocument()) {
if (hasMediaControls())
mediaControls()->hide();
return;
@@ -3652,7 +3689,10 @@ void HTMLMediaElement::configureMediaControls()
return;
mediaControls()->reset();
- mediaControls()->show();
+ if (shouldShowControls())
+ mediaControls()->show();
+ else
+ mediaControls()->hide();
}
void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assumption)
@@ -3712,9 +3752,9 @@ void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
void* HTMLMediaElement::preDispatchEventHandler(Event* event)
{
- if (event && event->type() == EventTypeNames::webkitfullscreenchange)
+ if (event && event->type() == EventTypeNames::webkitfullscreenchange) {
acolwell GONE FROM CHROMIUM 2014/08/05 19:36:34 nit: Revert. Change isn't necessary.
aberent 2014/08/22 14:08:33 Done.
configureMediaControls();
-
+ }
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698