Showing posts with label video. Show all posts
Showing posts with label video. Show all posts

Access Vlc Media Player From Java

Thursday, 20 March 2014

java logo

Vlc Media Player is a open source media player supports all audio and video Formats.
you can download it from vlc media player website
here is the link
Vlc Media Player
We can access vlc media player from java simply put this code.

 

try
{

String c="C:/Program Files/VideoLAN/VLC/vlc.exe -f   E:/dhoom3.mp4";
Runtime.getRuntime().exec(c);
 
}
catch(Exception exp)
{

System.out.println(exp);

}

Note:-This Project is developed on Windows 7 it may give differ output on other Operating systems

Play Video Using Java

Monday, 10 March 2014



Playing Multimedia Files Using java ,So to do this job we need to download Java Media Framework (JMF)
here is the link

JMF

Note:-JMF does’nt supports all media or video formats ex; .mp4,.flv etc. for more information kindly visit Oracle website Thanks.

I have used a .mpg file in this project

Now Import the following packages

import java.awt.BorderLayout;
import java.awt.Component;
import java.net.URL;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.swing.JFrame;

Now write down the following code on Jbutton action performed or Jframe Load as you wish


 

try

{
String mdurl=”file:///C:/Users/xyz/Desktop/phantom.mpg”;

URL url=new URL(mdurl);


Player player=Manager.createRealizedPlayer(url);

Component cmpt=player.getVisualComponent();  
    

Component ctrls=player.getControlPanelComponent();
    

cmpt.resize(600, 400);

this.add(cmpt,BorderLayout.CENTER);

ctrls.resize(600, 400);

this.add(ctrls,BorderLayout.SOUTH);

player.start();

this.resize(600, 400);

}

catch(Exception sdd)
{


System.out.println(sdd);


}

Paste Long Url