Thanks to everyone.
I have a TextureView to show a video using MediaPlayer . Before downloading the video, I prefer to show the background color. How to do it?
My code below does not work :(
The screen does not refresh 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); }
android
Darcy
source share