Solved

Using Java to record RTP Streams to file

Posted on 2007-11-14
4
2,328 Views
Last Modified: 2013-11-23
I am looking for a way to record RTP streams using Java. I am not an experienced Java programmer, mostly .net. I have been looking at the AvReceive2.java program and it works well for receiving RTP streams however, I cannot see a way for recording that stream into a file. Can anyone advise?

phodat
0
Comment
Question by:pHOdAT
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 20279142
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 20279186
I think here is a complete working solution for the same

http://forum.java.sun.com/thread.jspa?threadID=649762&messageID=3822599
0
 
LVL 5

Accepted Solution

by:
deeppra earned 500 total points
ID: 20279321
Below is a program to store RTP stream from network to a file

 public void update(ReceiveStreamEvent event) {
         // find the source session manager for this event
         SessionManager source = (SessionManager)event.getSource();
       
         // create a filewriter datasink if a new ReceiveStream
         // is detected
         if (event instanceof NewReceiveStreamEvent) {
             String cname = "Java Media Player";
             ReceiveStream stream = null;
             
             try {
                 // get the ReceiveStream
                 stream =((NewReceiveStreamEvent)event)
                         .getReceiveStream();
 
                 Participant part = stream.getParticipant();
 
                 // get the ReceiveStream datasource
                 DataSource dsource = stream.getDataSource();
 
                 // hand this datasource over to a file datasink
                 MediaLocator f = new MediaLocator("file://foo.au");
 
                 Manager.createDataSink(dsource, f);    
             } catch (Exception e) {
                 System.err.println("newReceiveStreamEvent exception "
                                    + e.getMessage());
                 return;
             }
         }
     }

for more information u can see this tutorial
http://72.5.124.55/products/java-media/jmf/2.1.1/guide/RTPExporting.html
0
 

Author Closing Comment

by:pHOdAT
ID: 31409166
Thanks for the info I couldn't find a code example to save myself and this is exactly what I needed.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now