vlc-android-sdk icon indicating copy to clipboard operation
vlc-android-sdk copied to clipboard

Exampel Simple Player

Open azzahrah opened this issue 7 years ago • 6 comments

hello

Any one can share howto use this sdk for simple player, add media to media list, and play media by index

TIA

azzahrah avatar Feb 28 '17 10:02 azzahrah

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

SaundersB avatar Mar 02 '17 14:03 SaundersB

Thank you..., but i try, sample code by edwardcw different version with this version

azzahrah avatar Mar 09 '17 12:03 azzahrah

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?

KnIfER avatar Jun 11 '17 15:06 KnIfER

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

KnIfER avatar Jun 11 '17 15:06 KnIfER

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 avatar Jun 12 '17 14:06 KnIfER

@KnIfER Do you have repository of working sample?

supirman avatar Jun 21 '17 09:06 supirman