How to attach SurfaceView on libVLC 1.9.8?

This forum is about all development around libVLC.
CRASH#
New Cone
New Cone
Posts: 5
Joined: 25 May 2016 10:56

How to attach SurfaceView on libVLC 1.9.8?

Postby CRASH# » 25 May 2016 11:34

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?

CRASH#
New Cone
New Cone
Posts: 5
Joined: 25 May 2016 10:56

Re: How to attach SurfaceView on libVLC 1.9.8?

Postby CRASH# » 25 May 2016 14:44

The answer:

Code: Select all

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

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: How to attach SurfaceView on libVLC 1.9.8?

Postby Jean-Baptiste Kempf » 28 Jun 2016 10:13

Yep.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

atiqmumtaz
New Cone
New Cone
Posts: 1
Joined: 14 Dec 2016 15:12

Re: How to attach SurfaceView on libVLC 1.9.8?

Postby atiqmumtaz » 14 Dec 2016 15:15

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();


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 13 guests