Android TextureView set background color and show video later

android

Solution

Put your TextureView on a layout alone. And set the layouts background color the color you want. Also set TextureView opacity to null.

Problem

Thanks everyone. I have a `TextureView` to show a video using `MediaPlayer`. Before the video is downloaded, I prefer to show a background color. How to do that ? My code below is not working :( Screen is not updated after `play` is called ``` public void play(String filename) { try { mPlayer.setDataSource(filename); mPlayer.setSurface(new Surface(getSurfaceTexture())); mPlayer.prepare(); mPlayer.setLooping(true); mPlayer.start(); } catch (IOException e) { Log.e("@", "fail to play video"); } } public void setPlaceholderColor(int color) { Canvas canvas = lockCanvas(); canvas.drawColor(color); unlockCanvasAndPost(canvas); } ```

Original source