Showing Videoview Media Controls At The Same Time As Showing System Ui
I'm using Android Studios default implementation of a full screen activity to show a full screen video. It works great except that the media controls only show up on click after th
Solution 1:
You just add your media controller methods to the SystemUI visibility change listener.
mSystemUiHider
.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
@Override@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public void onVisibilityChange(boolean visible) {
if(visible){
yourMediaController.show();
//Also i generally add the actionbar here as well!getActionBar().show();
} else {
yourMediaController.hide();
//Also i generally add the actionbar here as well!getActionBar().hide();
}
if (visible && AUTO_HIDE) {
// Schedule a hide().delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
}
});
Also in the mHideRunnable Runnable, you should add the hide methods for your mediaController so it hides after the specified time(usually 3 seconds.)
RunnablemHideRunnable=newRunnable() {
@Overridepublicvoidrun() {
mSystemUiHider.hide();
yourMediaController.hide();
//Optional Action Bar
getActionBar().hide();
}
};
Hope it helps!
Post a Comment for "Showing Videoview Media Controls At The Same Time As Showing System Ui"