Reputation: 50
I am currently using netbeans and i have downloaded the JMF plug in using its own plug in finder.I found one of the codes for video streaming using JMF from the net .The 'import javax.media.player' shows an error that package javax.media does not exists. Please help me in this matter as soon as possible.I am a beginner so a possible coding would be appreciated.
import java.awt.BorderLayout;
import java.awt.Component;
import java.io.IOException;
import java.net.URL;
import javax.media.CannotRealizeException;
import javax.media.Manager;
import javax.media.NoPlayerException;
import javax.media.Player;
import javax.swing.JPanel;
import javax.management.*;
public class MediaPlayer extends JPanel {
public MediaPlayer() {
setLayout( new BorderLayout() ); // use a BorderLayout
// Use lightweight components for Swing compatibility
Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, true );
try
{
// create a player to play the media specified in the URL
Player mediaPlayer = Manager.createRealizedPlayer("E:\\FFOutput\\Bollywood");
// get the components for the video and the playback controls
Component video = mediaPlayer.getVisualComponent();
Component controls = mediaPlayer.getControlPanelComponent();
if ( video != null )
add( video, BorderLayout.CENTER ); // add video component
if ( controls != null )
add( controls, BorderLayout.SOUTH ); // add controls
mediaPlayer.start(); // start playing the media clip
} // end try
catch ( NoPlayerException noPlayerException )
{
System.err.println( "No media player found" );
} // end catch
}
}
Upvotes: 0
Views: 19787
Reputation: 1
If your on Mac you need to do this:
In OSX, you can set the classpath from scratch like this:
export CLASSPATH=/path/to/some.jar:/path/to/some/other.jar
Or you can add to the existing classpath like this:
export CLASSPATH=$CLASSPATH:/path/to/some.jar:/path/to/some/other.jar
This is answering your exact question, I'm not saying it's the right or wrong thing to do; I'll leave that for others to comment upon.
Upvotes: 0
Reputation: 561
It seems that you have not added the required jar libraries to your project.
If you are on windows, try installing the JMF windows performance pack from this link:http://www.oracle.com/technetwork/java/javase/download-142937.html
This should resolve your error.
If you are on a different OS, follow the steps on the above mentioned link.
Upvotes: 4