android videoview black background

Viewed 2249

After looking around in order to avoid the black background before videoview is prepared, i've decided to post here a fix / trick.

Well, if you have no views on top of the videoview, use the "ZOrder" method:

videoView.setZOrderOnTop(true); //to "hide" before setting up your video
videoView.setZOrderOnTop(false); //after, in your videoView.setOnPreparedListener

BUT if you have some views on top of your videoview, this method will hide everything that has meant to be on top of your videoview, so just go with the "background" method, setting it before and after video is prepared:

video.setBackgroundColor( some color, maybe your app background ); //before
video.setBackgroundColor(Color.TRANSPARENT); //after, on prepare
0 Answers
Related