Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation

JAVI - Java Audio/Video Interface

Media integration for Java.

Automatically generated documentation for JAVI in Javadoc format can be found at


With Swing

JAVI integrates seamlessly with Swing through the SwingMediaPanel.

File videoFile = ...
// Open a media instance
Media media =;

// Load media into panel
SwingMediaPanel videoPanel = new SwingMediaPanel(media);

// Select a video & audio stream to play

// Create a simple panel to house player
JFrame display = new JFrame("JAVI Test");
display.setLayout(new BorderLayout());
display.add(BorderLayout.CENTER, videoPanel);
display.setSize(640, 480);

// Start video playback

It's that simple!
You may also be interested in JPlay, a one-class media player demonstrating the usage of JAVI.

With your graphics library of choice

SwingMediaPanel handles a bit of the backend, but if you wish to use a graphics library other than Swing, you'll need to utilise MediaStream.

File videoFile = ...
// Open a media instance
Media media =;

MediaStream stream = media
        .stream() // Begin setup
        // Specify audio handler; may be left out.
        .audio(new MediaHandler<byte[]>() {
            public void handle(byte[] buffer) {
                // buffer is in signed 16-bit little-endian PCM format.
                // frequency & channel count can be obtained from a AudioStream instance.
        // Specify video handler; may be left out.
        .video(new MediaHandler<BufferedImage>() {
            public void handle(BufferedImage buffer, long duration) {
                // buffer contains frame data
                // duration is the duration this frame should elapse before this frame;
                // taking into consideration audio-video sync.

            public void end() {
                // Notification on stream end
        // Create stream.
        // At least one handler must be specified, or an exception is thrown.

// Now we can start the stream synchronously;
// Or asynchronously
new Thread(stream).start();

As a Maven Dependency

The easiest way to get started with JAVI is with it as a dependency in your Maven project. You must first add our Maven repository, then add JAVI as a dependency.



Coding and Pull Requests Guidelines

  • We follow the Oracle coding conventions.
    • 4 spaces; not tabs.
    • No trailing whitespaces.
    • No 80 column limit.
  • Pull requests should be tested before submission.
  • Any additions in API should be properly documented.
  • Avoid unnecessary class coupling where possible.
  • Don't include IDE-specific files, class files, jar files, and whatnot; that is what the .gitignore is for!