Using LibVLC and Creation of a LibVLC object failed (Android)

869 views Asked by At

I am working on a Android project and I want to creat a media player using the LibVLC. To creat a media player with this lib I need to instantiate a LibVLC object. But when I try to do that the instantiation will failed and the app will close automatically.

Here is where I creat a LibVLC object :

public class MediaPlayerActivity extends Activity  {

private static final String TAG = "MediaPlayerDemo";
private int mVideoWidth;
private int mVideoHeight;
private MediaPlayer mMediaPlayer;
private SurfaceView mPreview;
private SurfaceHolder holder;
private String path;
private Bundle extras;
private static final String MEDIA = "media";
private boolean mIsVideoSizeKnown = false;
private boolean mIsVideoReadyToBePlayed = false;


   @Override
   public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.row);

        LibVLC lib = new LibVLC();
       // path = (String) getIntent().getSerializableExtra("path");
   }
}

I am using the LibVLC get on the master branch. So I don't understand why it failed.

2

There are 2 answers

1
liorlis On

Try to check if some of the requirements here are missing Hopefully it will assist you .

https://bitbucket.org/edwardcw/libvlc-android-sample

0
Payam Mobarraei On

you should do this to make new object of LibVLC

LibVLC libvlc = LibVLC.getInstance();
libvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
libvlc.eventVideoPlayerActivityCreated(true);
libvlc.setSubtitlesEncoding("");
libvlc.setAout(LibVLC.AOUT_OPENSLES);
libvlc.setTimeStretching(true);
libvlc.setChroma("RV32");
libvlc.setVerboseMode(true);