https://github.com/dmlloyd/openjdk
okay, on this occasion I will make an app to play video on NetBeans, one thing you should do before writing program is, download and install plugin for video or mp3 can be played, you can download it on this oracle official link : JMF Download, after you downloaded directly in install following the instructions from Oracle.
okay, just start our tutorial.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.media.*;
import java.net.*;
public class NewClass extends JFrame {
static Player mp4Player = null;
public NewClass() {
super("Demo JMF");
play();
Component panelControl = mp4Player.getControlPanelComponent();
Component visualComponent = mp4Player.getVisualComponent();
this.getContentPane().add(panelControl, BorderLayout.WEST);
this.getContentPane().add(visualComponent, BorderLayout.CENTER);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
stop();
System.exit(0);
}});
this.pack();
this.setSize(new Dimension(1080, 720));
this.setVisible(true);}
public static void main(String[] args) {
NewClass NewClass = new NewClass();
}
void play() {
try {URL url = new URL("file",null,"C:\\naruto.avi");
mp4Player = Manager.createRealizedPlayer(url);
mp4Player.start();
}
catch (Exception e) {
System.out.println("unable to play :" + e);
}}
void stop() {
mp4Player.stop();
mp4Player.close();}}
public class NewClass extends JFrame {
static Player mp4Player = null;super("Demo JMF");play();
Component panelControl = mp4Player.getControlPanelComponent();
Component visualComponent = mp4Player.getVisualComponent();
this.getContentPane().add(panelControl, BorderLayout.WEST);
this.getContentPane().add(visualComponent, BorderLayout.CENTER);
this.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent we) {stop(); System.exit(0);this.pack();
this.setSize(new Dimension(1080, 720));
this.setVisible(true);
void play() {
try {URL url = new URL("file",null,"C:\\naruto.mpg");
mp4Player = Manager.createRealizedPlayer(url);
mp4Player.start();
catch (Exception e) {
System.out.println("unable to play :" + e);
void stop() {
mp4Player.stop();
mp4Player.close();
https://gist.github.com/andilapulga/41fa0c3cf932b0af87877baabd437471