how to clear surface holder when media player is finished?

后端 未结 5 864
予麋鹿
予麋鹿 2021-01-04 05:50

I made a video player with surfaceview and mediaplayer. i have 10 videos and 10 buttons. if click on each buttons, each videos are playing.

here is my code..

5条回答
  •  悲哀的现实
    2021-01-04 06:29

    video.getHolder().setFormat(PixelFormat.TRANSPARENT);
    video.getHolder().setFormat(PixelFormat.OPAQUE);
    video.setVideoURI(Uri.parse(temp));
    video.setOnPreparedListener(new OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
          mp.start();
       }
    });
    

    it work for me

提交回复
热议问题