问题
I'm working on an application which has a home screen with video view in the background.
In a framed layout, the video is played behind buttons. When the main activity is loaded, the buttons are shown immediately, before the videoview is fully loaded, and because of that there are a few milliseconds of black background, and the buttons are shown.
I'm trying to make the buttons appear after the video in the background is fully loaded.
Is there a way to set listener to know when video has started? And in that way control when the buttons in the foreground will appear?
回答1:
Try this:
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
// Play From here
}
});
来源:https://stackoverflow.com/questions/44604319/videoview-is-loaded-listener