android vlc 实现本地视频循环播放

private void  initPlayer(SurfaceTexture surfaceTexture){

    final ArrayList<String> args = new ArrayList<>();
    args.add("-vvv");
    //  args.add("--gnutls-dir-trust certificateFolder");
    mLibVLC = new LibVLC(this,args);
    mMediaPlayer = new MediaPlayer(mLibVLC);
    mMediaPlayer.getVLCVout().setVideoSurface(surfaceTexture);
    mMediaPlayer.getVLCVout().attachViews();

    //mMediaPlayer.play(Uri.parse("https://v-cdn.zjol.com.cn/276996.mp4"));
    mMediaPlayer.play("/sdcard/1.mp4");
    mMediaPlayer.setEventListener(new MediaPlayer.EventListener() {
        @Override
        public void onEvent(MediaPlayer.Event event) {
            if(event.type == MediaPlayer.Event.EndReached){
                mMediaPlayer.play("/sdcard/1.mp4");
            }
        }
    });

}

猜你喜欢

转载自blog.csdn.net/rushjiujiu/article/details/127861365