Loading core/java/android/webkit/HTML5VideoFullScreen.java +4 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,10 @@ public class HTML5VideoFullScreen extends HTML5VideoView // Call into the native to ask for the state, if still in play mode, // this will trigger the video to play. mProxy.dispatchOnRestoreState(); if (getStartWhenPrepared()) { mPlayer.start(); } } public boolean fullScreenExited() { Loading core/java/android/webkit/HTML5VideoView.java +31 −13 Original line number Diff line number Diff line Loading @@ -194,20 +194,9 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { mPlayer.setOnInfoListener(proxy); } // Normally called immediately after setVideoURI. But for full screen, // this should be after surface holder created public void prepareDataAndDisplayMode(HTML5VideoViewProxy proxy) { // SurfaceTexture will be created lazily here for inline mode decideDisplayMode(); setOnCompletionListener(proxy); setOnPreparedListener(proxy); setOnErrorListener(proxy); setOnInfoListener(proxy); // When there is exception, we could just bail out silently. // No Video will be played though. Write the stack for debug public void prepareDataCommon(HTML5VideoViewProxy proxy) { try { mPlayer.setDataSource(mProxy.getContext(), mUri, mHeaders); mPlayer.setDataSource(proxy.getContext(), mUri, mHeaders); mPlayer.prepareAsync(); } catch (IllegalArgumentException e) { e.printStackTrace(); Loading @@ -219,6 +208,25 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { mCurrentState = STATE_NOTPREPARED; } public void reprepareData(HTML5VideoViewProxy proxy) { mPlayer.reset(); prepareDataCommon(proxy); } // Normally called immediately after setVideoURI. But for full screen, // this should be after surface holder created public void prepareDataAndDisplayMode(HTML5VideoViewProxy proxy) { // SurfaceTexture will be created lazily here for inline mode decideDisplayMode(); setOnCompletionListener(proxy); setOnPreparedListener(proxy); setOnErrorListener(proxy); setOnInfoListener(proxy); prepareDataCommon(proxy); } // Common code public int getVideoLayerId() { Loading Loading @@ -324,4 +332,14 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { return false; } private boolean m_startWhenPrepared = false; public void setStartWhenPrepared(boolean willPlay) { m_startWhenPrepared = willPlay; } public boolean getStartWhenPrepared() { return m_startWhenPrepared; } } core/java/android/webkit/HTML5VideoViewProxy.java +15 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,21 @@ class HTML5VideoViewProxy extends Handler if (mHTML5VideoView != null) { currentVideoLayerId = mHTML5VideoView.getVideoLayerId(); backFromFullScreenMode = mHTML5VideoView.fullScreenExited(); // When playing video back to back in full screen mode, // javascript will switch the src and call play. // In this case, we can just reuse the same full screen view, // and play the video after prepared. if (mHTML5VideoView.isFullScreenMode() && !backFromFullScreenMode && currentVideoLayerId != videoLayerId && mCurrentProxy != proxy) { mCurrentProxy = proxy; mHTML5VideoView.setStartWhenPrepared(true); mHTML5VideoView.setVideoURI(url, proxy); mHTML5VideoView.reprepareData(proxy); return; } } if (backFromFullScreenMode Loading Loading
core/java/android/webkit/HTML5VideoFullScreen.java +4 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,10 @@ public class HTML5VideoFullScreen extends HTML5VideoView // Call into the native to ask for the state, if still in play mode, // this will trigger the video to play. mProxy.dispatchOnRestoreState(); if (getStartWhenPrepared()) { mPlayer.start(); } } public boolean fullScreenExited() { Loading
core/java/android/webkit/HTML5VideoView.java +31 −13 Original line number Diff line number Diff line Loading @@ -194,20 +194,9 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { mPlayer.setOnInfoListener(proxy); } // Normally called immediately after setVideoURI. But for full screen, // this should be after surface holder created public void prepareDataAndDisplayMode(HTML5VideoViewProxy proxy) { // SurfaceTexture will be created lazily here for inline mode decideDisplayMode(); setOnCompletionListener(proxy); setOnPreparedListener(proxy); setOnErrorListener(proxy); setOnInfoListener(proxy); // When there is exception, we could just bail out silently. // No Video will be played though. Write the stack for debug public void prepareDataCommon(HTML5VideoViewProxy proxy) { try { mPlayer.setDataSource(mProxy.getContext(), mUri, mHeaders); mPlayer.setDataSource(proxy.getContext(), mUri, mHeaders); mPlayer.prepareAsync(); } catch (IllegalArgumentException e) { e.printStackTrace(); Loading @@ -219,6 +208,25 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { mCurrentState = STATE_NOTPREPARED; } public void reprepareData(HTML5VideoViewProxy proxy) { mPlayer.reset(); prepareDataCommon(proxy); } // Normally called immediately after setVideoURI. But for full screen, // this should be after surface holder created public void prepareDataAndDisplayMode(HTML5VideoViewProxy proxy) { // SurfaceTexture will be created lazily here for inline mode decideDisplayMode(); setOnCompletionListener(proxy); setOnPreparedListener(proxy); setOnErrorListener(proxy); setOnInfoListener(proxy); prepareDataCommon(proxy); } // Common code public int getVideoLayerId() { Loading Loading @@ -324,4 +332,14 @@ public class HTML5VideoView implements MediaPlayer.OnPreparedListener { return false; } private boolean m_startWhenPrepared = false; public void setStartWhenPrepared(boolean willPlay) { m_startWhenPrepared = willPlay; } public boolean getStartWhenPrepared() { return m_startWhenPrepared; } }
core/java/android/webkit/HTML5VideoViewProxy.java +15 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,21 @@ class HTML5VideoViewProxy extends Handler if (mHTML5VideoView != null) { currentVideoLayerId = mHTML5VideoView.getVideoLayerId(); backFromFullScreenMode = mHTML5VideoView.fullScreenExited(); // When playing video back to back in full screen mode, // javascript will switch the src and call play. // In this case, we can just reuse the same full screen view, // and play the video after prepared. if (mHTML5VideoView.isFullScreenMode() && !backFromFullScreenMode && currentVideoLayerId != videoLayerId && mCurrentProxy != proxy) { mCurrentProxy = proxy; mHTML5VideoView.setStartWhenPrepared(true); mHTML5VideoView.setVideoURI(url, proxy); mHTML5VideoView.reprepareData(proxy); return; } } if (backFromFullScreenMode Loading