Index: content/public/android/java/src/org/chromium/content/browser/ExternalVideoSurfaceDelegate.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ExternalVideoSurfaceDelegate.java b/content/public/android/java/src/org/chromium/content/browser/ExternalVideoSurfaceDelegate.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2c418f40fc9f8618f8b065ca0e9c60c98e0d2070 |
--- /dev/null |
+++ b/content/public/android/java/src/org/chromium/content/browser/ExternalVideoSurfaceDelegate.java |
@@ -0,0 +1,65 @@ |
+// Copyright 2014 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.content.browser; |
+ |
+/** |
+ * Interface to be implemented by the embedder to handle video hole punching. |
+ * |
+ * The expected behavior of the media player on the video hole punching is as follows. |
+ * 1) If it requests the surface, it will call onRequestExternalVideoSurface(). |
+ * When the resolution of the video is changed, it'll call onRequestExternalVideoSurface(). |
+ * 2) Whenever the size or the position of the video element is changed, it'll notify through |
+ * onExternalVideoSurfacePositionChanged(). |
+ * 3) Whenever the page that contains the video element is scrolled or zoomed, |
+ * onExternalVideoSurfaceRenderCoordinatesChanged() will be called. |
+ * 4) Usually steps 1) ~ 3) are repeated during the playback. |
+ * 5) If the player no longer needs the surface any more, it'll call |
+ * onReleaseExternalVideoSurface(). |
+ * |
+ * After onRequestExternalVideoSurface() is called, when the surface is created and visible, |
+ * calling ContentViewCore.attachExternalVideoSurface() is expected to associate the surface |
+ * with the player. |
+ * Before onReleaseExternalVideoSurface() is finished or when the surface is invisible, |
+ * calling ContentViewCore.detachExternalVideoSurface() is expected to release the association. |
+ * |
+ * Please contact ycheo@chromium.org (or wonsik@) if you have any questions for this interface. |
+ * |
+ */ |
+public interface ExternalVideoSurfaceDelegate { |
+ |
+ /** |
+ * Called when a media player wants to request an external video surface. |
+ * @param playerId The ID of the media player. |
+ */ |
+ void requestExternalVideoSurface(int playerId); |
+ |
+ /** |
+ * Called when a media player wants to release an external video surface. |
+ * @param playerId The ID of the media player. |
+ */ |
+ void releaseExternalVideoSurface(int playerId); |
+ |
+ /** |
+ * Called when the position of the video element which uses the external |
+ * video surface is changed. |
+ * @param playerId The ID of the media player. |
+ * @param left The absolute CSS X coordinate of the left side of the video element. |
+ * @param top The absolute CSS Y coordinate of the top side of the video element. |
+ * @param right The absolute CSS X coordinate of the right side of the video element. |
+ * @param bottom The absolute CSS Y coordinate of the bottom side of the video element. |
+ */ |
+ void onExternalVideoSurfacePositionChanged( |
+ int playerId, float left, float top, float right, float bottom); |
+ |
+ /** |
+ * Called when RenderCoordinates are updated. |
+ */ |
+ void onRenderCoordinatesChanged(); |
+ |
+ /** |
+ * Destory the object. |
+ */ |
+ void destroy(); |
+} |