Loading core/java/android/webkit/HTML5VideoFullScreen.java +5 −8 Original line number Diff line number Diff line Loading @@ -116,13 +116,12 @@ public class HTML5VideoFullScreen extends HTML5VideoView return mVideoSurfaceView; } HTML5VideoFullScreen(Context context, int videoLayerId, int position, boolean autoStart) { HTML5VideoFullScreen(Context context, int videoLayerId, int position) { mVideoSurfaceView = new VideoSurfaceView(context); mFullScreenMode = FULLSCREEN_OFF; mVideoWidth = 0; mVideoHeight = 0; init(videoLayerId, position, autoStart); init(videoLayerId, position); } private void setMediaController(MediaController m) { Loading Loading @@ -186,11 +185,6 @@ public class HTML5VideoFullScreen extends HTML5VideoView // after reading the MetaData if (mMediaController != null) { mMediaController.setEnabled(true); // If paused , should show the controller for ever! if (getAutostart()) mMediaController.show(); else mMediaController.show(0); } if (mProgressView != null) { Loading @@ -201,6 +195,9 @@ public class HTML5VideoFullScreen extends HTML5VideoView mVideoHeight = mp.getVideoHeight(); // This will trigger the onMeasure to get the display size right. mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight); // Call into the native to ask for the state, if still in play mode, // this will trigger the video to play. mProxy.dispatchOnRestoreState(); } public boolean fullScreenExited() { Loading core/java/android/webkit/HTML5VideoInline.java +2 −3 Original line number Diff line number Diff line Loading @@ -34,9 +34,8 @@ public class HTML5VideoInline extends HTML5VideoView{ } } HTML5VideoInline(int videoLayerId, int position, boolean autoStart) { init(videoLayerId, position, autoStart); HTML5VideoInline(int videoLayerId, int position) { init(videoLayerId, position); mTextureNames = null; } Loading core/java/android/webkit/HTML5VideoView.java +1 −10 Original line number Diff line number Diff line Loading @@ -52,10 +52,6 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { // Switching between inline and full screen will also create a new instance. protected MediaPlayer mPlayer; // This will be set up every time we create the Video View object. // Set to true only when switching into full screen while playing protected boolean mAutostart; // We need to save such info. protected Uri mUri; protected Map<String, String> mHeaders; Loading Loading @@ -141,22 +137,17 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { } } public boolean getAutostart() { return mAutostart; } public boolean getPauseDuringPreparing() { return mPauseDuringPreparing; } // Every time we start a new Video, we create a VideoView and a MediaPlayer public void init(int videoLayerId, int position, boolean autoStart) { public void init(int videoLayerId, int position) { mPlayer = new MediaPlayer(); mCurrentState = STATE_INITIALIZED; mProxy = null; mVideoLayerId = videoLayerId; mSaveSeekTime = position; mAutostart = autoStart; mTimer = null; mPauseDuringPreparing = false; } Loading core/java/android/webkit/HTML5VideoViewProxy.java +13 −6 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ class HTML5VideoViewProxy extends Handler private static final int POSTER_FETCHED = 202; private static final int PAUSED = 203; private static final int STOPFULLSCREEN = 204; private static final int RESTORESTATE = 205; // Timer thread -> UI thread private static final int TIMEUPDATE = 300; Loading Loading @@ -144,19 +145,16 @@ class HTML5VideoViewProxy extends Handler HTML5VideoViewProxy proxy, WebView webView) { // Save the inline video info and inherit it in the full screen int savePosition = 0; boolean savedIsPlaying = false; if (mHTML5VideoView != null) { // If we are playing the same video, then it is better to // save the current position. if (layerId == mHTML5VideoView.getVideoLayerId()) { savePosition = mHTML5VideoView.getCurrentPosition(); savedIsPlaying = mHTML5VideoView.isPlaying(); } mHTML5VideoView.pauseAndDispatch(mCurrentProxy); mHTML5VideoView.release(); } mHTML5VideoView = new HTML5VideoFullScreen(proxy.getContext(), layerId, savePosition, savedIsPlaying); layerId, savePosition); mCurrentProxy = proxy; mHTML5VideoView.setVideoURI(url, mCurrentProxy); Loading Loading @@ -192,7 +190,7 @@ class HTML5VideoViewProxy extends Handler mHTML5VideoView.release(); } mCurrentProxy = proxy; mHTML5VideoView = new HTML5VideoInline(videoLayerId, time, false); mHTML5VideoView = new HTML5VideoInline(videoLayerId, time); mHTML5VideoView.setVideoURI(url, mCurrentProxy); mHTML5VideoView.prepareDataAndDisplayMode(proxy); Loading Loading @@ -235,7 +233,7 @@ class HTML5VideoViewProxy extends Handler } public static void onPrepared() { if (!mHTML5VideoView.isFullScreenMode() || mHTML5VideoView.getAutostart()) { if (!mHTML5VideoView.isFullScreenMode()) { mHTML5VideoView.start(); } if (mBaseLayer != 0) { Loading Loading @@ -297,6 +295,11 @@ class HTML5VideoViewProxy extends Handler mWebCoreHandler.sendMessage(msg); } public void dispatchOnRestoreState() { Message msg = Message.obtain(mWebCoreHandler, RESTORESTATE); mWebCoreHandler.sendMessage(msg); } public void onTimeupdate() { sendMessage(obtainMessage(TIMEUPDATE)); } Loading Loading @@ -569,6 +572,9 @@ class HTML5VideoViewProxy extends Handler case STOPFULLSCREEN: nativeOnStopFullscreen(mNativePointer); break; case RESTORESTATE: nativeOnRestoreState(mNativePointer); break; } } }; Loading Loading @@ -696,6 +702,7 @@ class HTML5VideoViewProxy extends Handler private native void nativeOnPosterFetched(Bitmap poster, int nativePointer); private native void nativeOnTimeupdate(int position, int nativePointer); private native void nativeOnStopFullscreen(int nativePointer); private native void nativeOnRestoreState(int nativePointer); private native static boolean nativeSendSurfaceTexture(SurfaceTexture texture, int baseLayer, int videoLayerId, int textureName, int playerState); Loading Loading
core/java/android/webkit/HTML5VideoFullScreen.java +5 −8 Original line number Diff line number Diff line Loading @@ -116,13 +116,12 @@ public class HTML5VideoFullScreen extends HTML5VideoView return mVideoSurfaceView; } HTML5VideoFullScreen(Context context, int videoLayerId, int position, boolean autoStart) { HTML5VideoFullScreen(Context context, int videoLayerId, int position) { mVideoSurfaceView = new VideoSurfaceView(context); mFullScreenMode = FULLSCREEN_OFF; mVideoWidth = 0; mVideoHeight = 0; init(videoLayerId, position, autoStart); init(videoLayerId, position); } private void setMediaController(MediaController m) { Loading Loading @@ -186,11 +185,6 @@ public class HTML5VideoFullScreen extends HTML5VideoView // after reading the MetaData if (mMediaController != null) { mMediaController.setEnabled(true); // If paused , should show the controller for ever! if (getAutostart()) mMediaController.show(); else mMediaController.show(0); } if (mProgressView != null) { Loading @@ -201,6 +195,9 @@ public class HTML5VideoFullScreen extends HTML5VideoView mVideoHeight = mp.getVideoHeight(); // This will trigger the onMeasure to get the display size right. mVideoSurfaceView.getHolder().setFixedSize(mVideoWidth, mVideoHeight); // Call into the native to ask for the state, if still in play mode, // this will trigger the video to play. mProxy.dispatchOnRestoreState(); } public boolean fullScreenExited() { Loading
core/java/android/webkit/HTML5VideoInline.java +2 −3 Original line number Diff line number Diff line Loading @@ -34,9 +34,8 @@ public class HTML5VideoInline extends HTML5VideoView{ } } HTML5VideoInline(int videoLayerId, int position, boolean autoStart) { init(videoLayerId, position, autoStart); HTML5VideoInline(int videoLayerId, int position) { init(videoLayerId, position); mTextureNames = null; } Loading
core/java/android/webkit/HTML5VideoView.java +1 −10 Original line number Diff line number Diff line Loading @@ -52,10 +52,6 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { // Switching between inline and full screen will also create a new instance. protected MediaPlayer mPlayer; // This will be set up every time we create the Video View object. // Set to true only when switching into full screen while playing protected boolean mAutostart; // We need to save such info. protected Uri mUri; protected Map<String, String> mHeaders; Loading Loading @@ -141,22 +137,17 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { } } public boolean getAutostart() { return mAutostart; } public boolean getPauseDuringPreparing() { return mPauseDuringPreparing; } // Every time we start a new Video, we create a VideoView and a MediaPlayer public void init(int videoLayerId, int position, boolean autoStart) { public void init(int videoLayerId, int position) { mPlayer = new MediaPlayer(); mCurrentState = STATE_INITIALIZED; mProxy = null; mVideoLayerId = videoLayerId; mSaveSeekTime = position; mAutostart = autoStart; mTimer = null; mPauseDuringPreparing = false; } Loading
core/java/android/webkit/HTML5VideoViewProxy.java +13 −6 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ class HTML5VideoViewProxy extends Handler private static final int POSTER_FETCHED = 202; private static final int PAUSED = 203; private static final int STOPFULLSCREEN = 204; private static final int RESTORESTATE = 205; // Timer thread -> UI thread private static final int TIMEUPDATE = 300; Loading Loading @@ -144,19 +145,16 @@ class HTML5VideoViewProxy extends Handler HTML5VideoViewProxy proxy, WebView webView) { // Save the inline video info and inherit it in the full screen int savePosition = 0; boolean savedIsPlaying = false; if (mHTML5VideoView != null) { // If we are playing the same video, then it is better to // save the current position. if (layerId == mHTML5VideoView.getVideoLayerId()) { savePosition = mHTML5VideoView.getCurrentPosition(); savedIsPlaying = mHTML5VideoView.isPlaying(); } mHTML5VideoView.pauseAndDispatch(mCurrentProxy); mHTML5VideoView.release(); } mHTML5VideoView = new HTML5VideoFullScreen(proxy.getContext(), layerId, savePosition, savedIsPlaying); layerId, savePosition); mCurrentProxy = proxy; mHTML5VideoView.setVideoURI(url, mCurrentProxy); Loading Loading @@ -192,7 +190,7 @@ class HTML5VideoViewProxy extends Handler mHTML5VideoView.release(); } mCurrentProxy = proxy; mHTML5VideoView = new HTML5VideoInline(videoLayerId, time, false); mHTML5VideoView = new HTML5VideoInline(videoLayerId, time); mHTML5VideoView.setVideoURI(url, mCurrentProxy); mHTML5VideoView.prepareDataAndDisplayMode(proxy); Loading Loading @@ -235,7 +233,7 @@ class HTML5VideoViewProxy extends Handler } public static void onPrepared() { if (!mHTML5VideoView.isFullScreenMode() || mHTML5VideoView.getAutostart()) { if (!mHTML5VideoView.isFullScreenMode()) { mHTML5VideoView.start(); } if (mBaseLayer != 0) { Loading Loading @@ -297,6 +295,11 @@ class HTML5VideoViewProxy extends Handler mWebCoreHandler.sendMessage(msg); } public void dispatchOnRestoreState() { Message msg = Message.obtain(mWebCoreHandler, RESTORESTATE); mWebCoreHandler.sendMessage(msg); } public void onTimeupdate() { sendMessage(obtainMessage(TIMEUPDATE)); } Loading Loading @@ -569,6 +572,9 @@ class HTML5VideoViewProxy extends Handler case STOPFULLSCREEN: nativeOnStopFullscreen(mNativePointer); break; case RESTORESTATE: nativeOnRestoreState(mNativePointer); break; } } }; Loading Loading @@ -696,6 +702,7 @@ class HTML5VideoViewProxy extends Handler private native void nativeOnPosterFetched(Bitmap poster, int nativePointer); private native void nativeOnTimeupdate(int position, int nativePointer); private native void nativeOnStopFullscreen(int nativePointer); private native void nativeOnRestoreState(int nativePointer); private native static boolean nativeSendSurfaceTexture(SurfaceTexture texture, int baseLayer, int videoLayerId, int textureName, int playerState); Loading