Skip to content

Latest commit

 

History

History
94 lines (71 loc) · 2.21 KB

README.md

File metadata and controls

94 lines (71 loc) · 2.21 KB

Intro

VLCJ binding for Processing.

Simple wrapper with unified processing video interface.

Built considering GSVideo live streaming video troubles.

Github project page

VLCJ project home

VLCJ github page

Install

Download and unzip library archive into your Processing libraries folder.

Example

HelloWorld

import ru.devdep.processing.vlcj.*;

VLCJVideo video;

protected final static int WIDTH = 1920;
protected final static int HEIGHT = 1080;

void setup() {
  size( WIDTH, HEIGHT );
  video = new VLCJVideo( this, "--no-video-title-show" );
  video.openMedia( "test.mp4" );
  video.loop();
  video.play();
}

void draw() {
  background( 0 );
  image( video, 0, 0 );
}

HelloEventedWorld

import ru.devdep.processing.vlcj.*;

import uk.co.caprica.vlcj.player.events.MediaPlayerEventType;

VLCJVideo video;

protected final static int WIDTH = 1920;
protected final static int HEIGHT = 1080;

void setup() {
  size( WIDTH, HEIGHT );
  video = new VLCJVideo( this, "--no-video-title-show" );
  video.openMedia( "http://example.com/movie.mp4" );
  video.loop();
  video.play();
  bindVideoEvents();
}

void bindVideoEvents() {
  video.bind( MediaPlayerEventType.FINISHED, new Runnable() { public void run() {
    println( "finished" );
  } } );
  video.bind( MediaPlayerEventType.OPENING, new Runnable() { public void run() {
    println( "opened" );
  } } );
  video.bind( MediaPlayerEventType.ERROR, new Runnable() { public void run() {
    println( "error" );
  } } );
  video.bind( MediaPlayerEventType.PAUSED, new Runnable() { public void run() {
    println( "paused" );
  } } );
  video.bind( MediaPlayerEventType.STOPPED, new Runnable() { public void run() {
    println( "stopped" );
  } } );
  video.bind( MediaPlayerEventType.PLAYING, new Runnable() { public void run() {
    println( "playing" );
  } } );
  video.bind( MediaPlayerEventType.MEDIA_STATE_CHANGED, new Runnable() { public void run() {
    println( "state changed" );
  } } );
}

void draw() {
  background( 0 );
  image( video, 0, 0 );
}