-
Notifications
You must be signed in to change notification settings - Fork 245
Home
Welcome to the vlc-android-sdk wiki!
// Display surface
private SurfaceView surfaceView;
private SurfaceHolder holder;
// MediaPlayer setup
private MediaPlayer mediaPlayer;
private LibVLC libVLC;
private Surface surface;
private IVLCVout vout;
private Media media;
private String URL_TO_STREAM = "https://example.url:8002/stream"
surfaceView = (SurfaceView) findViewById(R.id.playChannelVideoView);
holder = surfaceView.getHolder();
// Create the player
libVLC = new LibVLC(context, options);
mediaPlayer = new MediaPlayer(libVLC);
//Create the media
media = new Media(libVLC, AndroidUtil.LocationToUri(URL_TO_STREAM));
mediaPlayer.setMedia(media);
// Setup the surface
surface = surfaceHolder.getSurface();
vout = mediaPlayer.getVLCVout();
vout.setVideoSurface(surface, surfaceHolder);
vout.attachViews();
mediaPlayer.play();