vlc-android-sdk
vlc-android-sdk copied to clipboard
Exampel Simple Player
hello
Any one can share howto use this sdk for simple player, add media to media list, and play media by index
TIA
See here: https://bitbucket.org/edwardcw/libvlc-android-sample
Thank you..., but i try, sample code by edwardcw different version with this version
well,following the example above I can easily play a .mp3 sound file,but I have no idea how to display a video file.can u give me more hints?
use such code below in onCreate method just crash the app,and throw"io....null pointer error.....try to call .getDir() on ....." code:MediaPlayer mMediaplayer = new org.videolan.libvlc.media.MediaPlayer();
it seems that I can only use this: LibVLC mLibVLC = new LibVLC(this); mMediaPlayer= new org.videolan.libvlc.MediaPlayer(mLibVLC);
hahaha I figured it out,referring to issue "Update surfaceview when replaying video #78". do like this:(just partial)
public class VlcMainActivity extends Activity implements SurfaceHolder.Callback, Callback { onCreate() {
mMediaPlayer = new MediaPlayer(mLibVLC);
mMediaPlayer.getVLCVout().setVideoView(mSurfaceView);
mMediaPlayer.getVLCVout().addCallback(this);
mMediaPlayer.getVLCVout().attachViews();
playMediaAtPath("/sdcard/myFolder/abc.mp4");
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
if (mMediaPlayer != null) {
mSurfaceHolder = holder;
mMediaPlayer.getVLCVout().detachViews();
mMediaPlayer.getVLCVout().setVideoSurface(holder.getSurface(), holder);
mMediaPlayer.getVLCVout().attachViews();
//mMediaPlayer.getVLCVout().setVideoSurface(holder.getSurface(), holder);
}
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
mSurfaceHolder = holder;
if (mMediaPlayer != null) {
//mMediaPlayer.attachSurface(holder.getSurface(), this);//, width, height
mMediaPlayer.getVLCVout().detachViews();
mMediaPlayer.getVLCVout().setVideoSurface(holder.getSurface(), holder);
mMediaPlayer.getVLCVout().attachViews();
}
if (width > 0) {
mVideoHeight = height;
mVideoWidth = width;
}
}
}
@KnIfER Do you have repository of working sample?