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

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

Issue 928643003: Upstream Chrome for Android Cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix dependencies (second attempt). Created 5 years, 9 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: chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..3982cf611f4c5b9de2f9ab6cb92fd2ce81ec6ce7
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteVideoInfo.java
@@ -0,0 +1,115 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.media.remote;
+
+import android.text.TextUtils;
+
+/**
+ * Exposes information about the current video to the external clients.
+ */
+public class RemoteVideoInfo {
+
+ /**
+ * This lists all the states that the remote video can be in.
+ */
+ public enum PlayerState {
+ /** The remote player is currently stopped. */
+ STOPPED,
+
+ /** The remote player is buffering this video. */
+ LOADING,
+
+ /** The remote player is playing this video. */
+ PLAYING,
+
+ /** The remote player is paused. */
+ PAUSED,
+
+ /** The remote player is in an error state. */
+ ERROR,
+
+ /** The remote player has been replaced by another player (so the current session has
+ * finished) */
+ INVALIDATED,
+
+ /** The remote video has completed playing. */
+ FINISHED
+ }
+
+ /**
+ * The title of the video
+ */
+ public String title;
+ /**
+ * The duration of the video
+ */
+ public int durationMillis;
+ /**
+ * The current state of the video
+ */
+ public PlayerState state;
+ /**
+ * The last known position in the video
+ */
+ public int currentTimeMillis;
+ /**
+ * The current error message, if any
+ */
+ // TODO(aberent) At present nothing sets this to anything other than Null.
+ public String errorMessage;
+
+ /**
+ * Create a new RemoteVideoInfo
+ * @param title
+ * @param durationMillis
+ * @param state
+ * @param currentTimeMillis
+ * @param errorMessage
+ */
+ public RemoteVideoInfo(String title, int durationMillis, PlayerState state,
+ int currentTimeMillis, String errorMessage) {
+ this.title = title;
+ this.durationMillis = durationMillis;
+ this.state = state;
+ this.currentTimeMillis = currentTimeMillis;
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ * Copy a remote video info
+ * @param other the source.
+ */
+ public RemoteVideoInfo(RemoteVideoInfo other) {
+ this(other.title, other.durationMillis, other.state, other.currentTimeMillis,
+ other.errorMessage);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof RemoteVideoInfo)) {
+ return false;
+ }
+
+ RemoteVideoInfo other = (RemoteVideoInfo) obj;
+ return durationMillis == other.durationMillis
+ && currentTimeMillis == other.currentTimeMillis
+ && state == other.state
+ && TextUtils.equals(title, other.title)
+ && TextUtils.equals(errorMessage, other.errorMessage);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = durationMillis;
+ result = 31 * result + currentTimeMillis;
+ result = 31 * result + (title == null ? 0 : title.hashCode());
+ result = 31 * result + (state == null ? 0 : state.hashCode());
+ result = 31 * result + (errorMessage == null ? 0 : errorMessage.hashCode());
+ return result;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698