|
4 | 4 | import android.content.Context; |
5 | 5 | import android.media.MediaPlayer; |
6 | 6 | import android.media.Metadata; |
7 | | -import android.util.Log; |
8 | 7 | import android.view.Gravity; |
9 | 8 | import android.view.MotionEvent; |
10 | 9 | import android.view.SurfaceHolder; |
11 | 10 | import android.view.SurfaceView; |
12 | 11 | import android.view.View; |
13 | 12 | import android.view.ViewGroup; |
14 | | -import android.webkit.HTML5VideoView; |
15 | | -import android.webkit.HTML5VideoViewProxy; |
16 | 13 | import android.widget.FrameLayout; |
17 | 14 | import android.widget.MediaController; |
18 | 15 | import android.widget.MediaController.MediaPlayerControl; |
@@ -150,7 +147,7 @@ public void decideDisplayMode() { |
150 | 147 | private void prepareForFullScreen() { |
151 | 148 | // So in full screen, we reset the MediaPlayer |
152 | 149 | mPlayer.reset(); |
153 | | - MediaController mc = new MediaController(mProxy.getContext()); |
| 150 | + MediaController mc = new FullScreenMediaController(mProxy.getContext(), mLayout); |
154 | 151 | mc.setSystemUiVisibility(mLayout.getSystemUiVisibility()); |
155 | 152 | setMediaController(mc); |
156 | 153 | mPlayer.setScreenOnWhilePlaying(true); |
@@ -261,9 +258,6 @@ public void enterFullScreenVideoState(int layerId, |
261 | 258 | mLayout.addView(getSurfaceView(), layoutParams); |
262 | 259 |
|
263 | 260 | mLayout.setVisibility(View.VISIBLE); |
264 | | - mLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE |
265 | | - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); |
266 | | - |
267 | 261 | WebChromeClient client = webView.getWebChromeClient(); |
268 | 262 | if (client != null) { |
269 | 263 | client.onShowCustomView(mLayout, mCallback); |
@@ -340,4 +334,33 @@ protected void switchProgressView(boolean playerBuffering) { |
340 | 334 | } |
341 | 335 | return; |
342 | 336 | } |
| 337 | + |
| 338 | + static class FullScreenMediaController extends MediaController { |
| 339 | + |
| 340 | + View mVideoView; |
| 341 | + |
| 342 | + public FullScreenMediaController(Context context, View video) { |
| 343 | + super(context); |
| 344 | + mVideoView = video; |
| 345 | + } |
| 346 | + |
| 347 | + @Override |
| 348 | + public void show() { |
| 349 | + super.show(); |
| 350 | + if (mVideoView != null) { |
| 351 | + mVideoView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); |
| 352 | + } |
| 353 | + } |
| 354 | + |
| 355 | + @Override |
| 356 | + public void hide() { |
| 357 | + if (mVideoView != null) { |
| 358 | + mVideoView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE |
| 359 | + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); |
| 360 | + } |
| 361 | + super.hide(); |
| 362 | + } |
| 363 | + |
| 364 | + } |
| 365 | + |
343 | 366 | } |
0 commit comments