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; |
+ } |
+} |