VideoView“已加载"听众? [英] VideoView "is loaded" listener?

查看:70
本文介绍了VideoView“已加载"听众?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个具有主屏幕且在后台具有视频视图的应用程序.
在框架式布局中,视频在按钮后面播放.加载主活动时,在完全加载视频视图之前会立即显示按钮,因此黑色背景只有几毫秒,因此会显示按钮.
我正在尝试使按钮在后台视频完全加载后显示.
有没有一种方法可以让收听者知道视频何时开始播放?并以此方式控制前景中的按钮何时出现?

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?

推荐答案

尝试一下:

videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                            @Override
                            public void onPrepared(MediaPlayer mp) {
                            // Play From here
                            }
                        });

这篇关于VideoView“已加载"听众?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆