Page 1 of 1

How to attach SurfaceView on libVLC 1.9.8?

Posted: 25 May 2016 11:34
by CRASH#
Hello, on version 1.0.6 I am using follow code:

Code: Select all

mSurfaceView = (SurfaceView) mainActivity.findViewById(R.id.surfaceView); mSurfaceHolder = mSurfaceView.getHolder(); mLibVLC = new LibVLC(); mLibVLC.setAout(mLibVLC.AOUT_AUDIOTRACK); mLibVLC.setVout(mLibVLC.VOUT_ANDROID_SURFACE); mLibVLC.init(mainActivity); mSurface = mSurfaceHolder.getSurface(); mLibVLC.attachSurface(mSurface, this); mLibVLC.playMRL(url);
But version 1.9.8 doesn't have attachSurface method.

How I can attach the surface?

Re: How to attach SurfaceView on libVLC 1.9.8?

Posted: 25 May 2016 14:44
by CRASH#
The answer:

Code: Select all

IVLCVout vout = mMediaPlayer.getVLCVout(); vout.setVideoView(mSurface); vout.addCallback(this); vout.attachViews();

Re: How to attach SurfaceView on libVLC 1.9.8?

Posted: 28 Jun 2016 10:13
by Jean-Baptiste Kempf
Yep.

Re: How to attach SurfaceView on libVLC 1.9.8?

Posted: 14 Dec 2016 15:15
by atiqmumtaz
ArrayList<String> options = new ArrayList<>();
options.add("--http-reconnect");
options.add("--network-caching=2000");
LibVLC mLibVLC = new LibVLC(options);
MediaPlayer sMediaPlayer = new MediaPlayer(mLibVLC);
Media media = new Media(mLibVLC, AndroidUtil.LocationToUri("Your HTTP/RTMP URL IN STRING FORMAT"));
sMediaPlayer.setMedia(media);

SurfaceView mSurface = mSurfaceHolder.getSurface();

IVLCVout vout = sMediaPlayer.getVLCVout();
vout.setVideoSurface(mSurface, mSurfaceHolder);
vout.attachViews();

sMediaPlayer.play();