vlc-android-sdk
vlc-android-sdk copied to clipboard
about play file in cell phone
I am wondering if I can play media file via playMRL()? for example try { mLibVLC = new LibVLC(); mLibVLC.setAout(mLibVLC.AOUT_AUDIOTRACK); mLibVLC.setVout(mLibVLC.VOUT_ANDROID_SURFACE); mLibVLC.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
mLibVLC.init(getApplicationContext());
} catch (LibVlcException e){
Log.e(TAG, e.toString());
}
mSurface = mSurfaceHolder.getSurface();
mLibVLC.attachSurface(mSurface, VideoVLCActivity.this);
mLibVLC.playMRL("/storage/emulated/0/Download/xxx.mp4");
As far as I know you can't do that anymore in new versions of LibVLC.
There are no methods that are media-related in VLC instance anymore, you need to use MediaPlayer to play media.
You can wrap MRL with Media and then play:
Java mediaPlayer.setMedia(new Media(VLCInstance.get(), mrl)); media.release(); mediaPlayer.play()
See libvlc sources for reference: https://code.videolan.org/videolan/vlc-android/blob/2.1.1/vlc-android/src/org/videolan/vlc/PlaybackService.java (see playIndex method for example)
thanks for the response. I've tried the following code and it works MediaList list = libvlc.getMediaList(); list.clear(); list.add(new Media(mLibVLC, LibVLC.PathToURI("/storage/emulated/0/Download/xxx.mp4")), false); mLibVLC.playIndex(0);
It is working only if target sdk 22 in build.gradle, when target sdk increase to 25 then a dialog appear "Detected problem with app native libraries (please consult log detail): libvlcjni.so: text relocations."