JSup - Forlani

JSupVideo - an interface to show cameras and other videos in a JSup application (Bozza)

JSup is able to show video from many sources and can make the client to see videos from sources (cameras for example) that are only available from the server network.
These video capabilities are provided by using VLC media player link that must be installed with JSup server and native clients, while web clients can display those videos with no need to install VLC.

JSupInterface.JSupVideo is a class that holds information about a video that can be shown in a Canvas to show cameras and other videos in a JSup application.

The info held by this class are:

JSupVideo definition

These informations will be the same for server and client, so the definition of the JSup video must be put in a shared domain curly brackets JavaCode function called something like "{VideoDefinition}", included in the user domain also (this is important because both shared and user domains must define the JSupVideo objects in the same order to match their internal ids), and with a body like:

// mux/transcode automatico da estensione di <TT>clientVideoPage</TT>
public static final JSupVideo demoVideo = JSupVideo.define("Demo.mp4", "C:\\video\\demo video.mkv", 500, 300);
public static final JSupVideo camera4 = JSupVideo.define("camera4.ogg", "rtsp://user:password@192.168.1.64:554/Streaming/Channels/102", 500, 300);

// OGG
//public static final JSupVideo camera4 = JSupVideo.define("camera4.ogg", "rtsp://user:password@192.168.1.64:554/Streaming/Channels/102", JSupVideo.VideoFormat.OGG, 500, 300);

// MP4
//public static final JSupVideo camera4 = JSupVideo.define("camera4.mp4", "rtsp://user:password@192.168.1.64:554/Streaming/Channels/102", JSupVideo.VideoFormat.OGG, 500, 300);

//WEBM
//public static final JSupVideo camera4 = JSupVideo.define("camera4.webm", "rtsp://user:password@192.168.1.64:554/Streaming/Channels/102", JSupVideo.VideoFormat.WEBM, 500, 300);


The JSup videos will be streamed by the JSup server only when requested by clients. So when a client requests a video the server starts to stream the video, and, when no client request that video any more, the server will stop to stream it.

Play a JSupVideo in a window

A special JSup Graphic object have to be used to display a JSupVideo: select from the JSup menu Draw / Video canvas and draw the rectangle of the canvas.
Each canvas must a have its own video control object (interface JSupVideo.Control).
The control object must be defined in the window JavaCode common like:

static JSupVideo.Control camera4Control;

A pseudo Enable animation can be used to bind the Video canvas to the JSupVideo and obtain the control object, use a JavaCode like:

camera4Control = thisGraphObj.bindCanvasToVideo( camera4 );
return true; 


Then the video can be played in the Action animation of a button with a JavaCode like:

crudeliaControl.startVideo();

The methods of the JSupVideo.Control interface are:

Server/client Configuration

VLC link (32 bit version) must be installed to stream (the server) and to play (the clients).
Both in the JSup server and native clients you have to specify the VLC installation dir in the JSup.cfg file defining the video.vlc.path system property:

#-------- the location of the libvlc.dll to be used for JSupVideo
-Dvideo.vlc.path=C:\Program Files (x86)\VideoLAN\VLC


In the JSup Application property dialog two properties must be defined:

video.streamserver.bindaddr=127.0.0.1
video.streamserver.port=7080

Please note that the video.streamserver.port property is mandatory to have the JSupVideo system to work.

Problem solving

To avoid, when libvlc library is initialized on JSup startup, many error lines in the JSup output like:
  main libvlc error: stale plugins cache: modified C:\Progr...
exec the following command in a administrative command prompt in the C:\Program Files (x86)\VideoLAN\VLC directory:

vlc-cache-gen.exe  "c:\Program Files (x86)\VideoLAN\VLC\plugins"