Streaming live video from i.p. camera
843810Jul 25 2010 — edited Jul 25 2010hello all java gurus i am working on streaming a live video from an axis i.p. camera as my final year project below is my piece of code please any help is appreciated as i have tried this on a forum before but did not get any answers.
public class mymediap extends JPanel
{
public mymediap( )
{
setLayout( new BorderLayout() ); // use a BorderLayout
Manager.setHint( Manager.LIGHTWEIGHT_RENDERER, new Boolean(true) );
try
{
String mediaURL="rtsp://192.168.0.90/axis-media/media.amp?videocodec=h264&resolution=640x480&RTSP/1.0";
MediaLocator medialoc = new MediaLocator(mediaURL);
Player myPlayer = Manager.createPlayer(medialoc);//Manager.createRealizedPlayer(ml);
// get the components for the video and the playback controls
Component myvideo = myPlayer.getVisualComponent();
Component controls = myPlayer.getControlPanelComponent();
if ( myvideo != null )
add( myvideo, BorderLayout.CENTER ); // add video component
if ( controls != null )
add( controls, BorderLayout.SOUTH ); // add controls
myPlayer.start(); // start playing the media clip
} // end try
catch ( NoPlayerException noPlayerException )
{
System.err.println( "No media player found" );
}
catch (Exception e){
System.out.println("hello: " + e);
}
}
}
when i ran the code i got an error. below is the error.
Exception in thread "JMF thread: com.sun.media.content.rtsp.Handler@14f8dab[ com.sun.media.content.rtsp.Handler@14f8dab ] ( realizeThread)" java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
at java.lang.Double.valueOf(Double.java:475)
at java.lang.Double.<init>(Double.java:567)
at com.sun.media.content.rtsp.RtspUtil.setDuration(RtspUtil.java:521)
at com.sun.media.content.rtsp.RtspUtil.rtspSetup(RtspUtil.java:168)
at com.sun.media.content.rtsp.Handler.initRtspSession(Handler.java:117)
at com.sun.media.content.rtsp.Handler.doRealize(Handler.java:84)
at com.sun.media.RealizeWorkThread.process(BasicController.java:1400)
at com.sun.media.StateTransitionWorkThread.run(BasicController.java:1339)
please help me.