VideoView “is loaded” listener?

血红的双手。 提交于 2019-12-11 07:35:55

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!