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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java

Issue 1607043002: Only show cast button if video can be cast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix null pointer error (found by telemetry smoke tests!) Created 4 years, 11 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
index f05d6ae9819d64c503108ec3427a246bafa148f4..eddf53906936b49f3d72276c9073ee662a86d691 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
@@ -330,18 +330,19 @@ public abstract class AbstractMediaRouteController implements MediaRouteControll
for (UiListener listener : mUiListeners) {
listener.onRouteSelected(route.getName(), this);
}
- if (mMediaStateListener == null) return;
if (!canCastMedia()) return;
- startCastingVideo(route);
- }
-
- private void startCastingVideo(RouteInfo route) {
if (mMediaStateListener == null) return;
mMediaStateListener.pauseLocal();
mMediaStateListener.onCastStarting(route.getName());
+ startCastingVideo();
+ }
+
+ // This exists for compatibility with old downstream code
+ // TODO(aberent) convert to abstract
+ protected void startCastingVideo() {
String url = mMediaStateListener.getSourceUrl();
Uri uri = url == null ? null : Uri.parse(url);
- setDataSource(uri, mMediaStateListener.getCookies(), mMediaStateListener.getUserAgent());
+ setDataSource(uri, mMediaStateListener.getCookies());
prepareAsync(
mMediaStateListener.getFrameUrl(), mMediaStateListener.getStartPositionMillis());
}
@@ -585,27 +586,13 @@ public abstract class AbstractMediaRouteController implements MediaRouteControll
return getMediaStateListener().getPosterBitmap();
}
- /**
- * Called to prepare the remote playback asyncronously. onPrepared() of the current remote media
- * player object is called when the player is ready.
- *
- * @param startPositionMillis indicates where in the stream to start playing
- */
- protected abstract void prepareAsync(String frameUrl, long startPositionMillis);
-
- // TODO(aberent): Temp to change args while avoiding need for two sided patch for YT.
- void setDataSource(Uri uri, String cookies, String userAgent) {
- setDataSource(uri, cookies);
- };
+ // This exists for compatibility with old downstream code
+ // TODO(aberent) remove
+ protected void prepareAsync(String frameUrl, long startPositionMillis){};
- /**
- * Temp default version to allow override in YouTubeMediaRouteController, while not
- * requiring it in DefaultMediaRouteController.
- * TODO(aberent): Fix YT and remove.
- * @param uri
- * @param cookies
- */
- public void setDataSource(Uri uri, String cookies) {};
+ // This exists for compatibility with old downstream code
+ // TODO(aberent) remove
+ protected void setDataSource(Uri uri, String cookies){};
protected boolean reconnectAnyExistingRoute() {
// Temp version to avoid two sided patch while removing
@@ -613,6 +600,12 @@ public abstract class AbstractMediaRouteController implements MediaRouteControll
};
@Override
+ public void checkIfPlayableRemotely(String sourceUrl, String frameUrl, String cookies,
+ String userAgent, MediaValidationCallback callback) {
+ callback.onResult(true, sourceUrl, frameUrl);
+ }
+
+ @Override
public String getUriPlaying() {
return null;
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/media/remote/DefaultMediaRouteController.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698