Forum Stats

  • 3,852,841 Users
  • 2,264,141 Discussions
  • 7,905,157 Comments

Discussions

Streaming live video from i.p. camera

843810
843810 Member Posts: 46,938
edited Jul 25, 2010 6:42AM in Java Desktop Applications
hello 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: [email protected][ [email protected] ] ( 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.

Comments

  • 793415
    793415 Member Posts: 7,279 Bronze Badge
    toks2003 wrote:
    hello 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.
    1) What forum? Please provide an URL to the thread.
    2) When posting code or code snippets, HTML/XML or input output, please use the code tags. The code tags protect the indentation and formatting of the sample. To use the code tags, select the sample and click the CODE button.
    3) And since code indenting came up, I noted you did not indent any of that code. Please use one of the 2 common forms of indenting code blocks so that the code is easier to follow. Further, use the common nomenclature for classes, methods and attributes. That would be AllUpperClassName, firstLowerAttributeName & firstLowerMethodName().
    4) You have better chance of help if you post an SSCCE *(<- link)* as opposed to code snippets.
    5) There is a dedicated [JMF forum|http://forums.sun.com/forum.jspa?forumID=28] *(<- link),* but JMF was abandoned years ago, and I doubt it will work with IP cameras. If you think your thread will do better there, mention it and I'll get a moderator to move it.
    6) It is possible to gain images from an IP camera without using JMF. See [this thread|http://forums.sun.com/thread.jspa?threadID=5438765] *(<- link).* The OP became quite hostile and the thread was locked, which is a pity since I had an interest in following it.
    7) Using a single upper case letter at the start of every sentence makes a post easier to read, and easier to help. You would not want to make it harder to help, would you?

    ..and finally.
    please help me.
    8) Please try not to sound pathetic. It makes you sound needy, and lowers the chance of getting help.
  • 843810
    843810 Member Posts: 46,938
    Thanks i appreciate your response i shall now try and post it on your recommended forum. thanks.
  • 793415
    793415 Member Posts: 7,279 Bronze Badge
    Note that this thread is continued on [http://forums.sun.com/thread.jspa?threadID=5445913].
This discussion has been closed.