FileDocCategorySizeDatePackage
Example11_2.javaAPI DocJMF 2.1.1e1644Mon May 12 12:20:28 BST 2003None

Example11_2

public abstract class Example11_2 extends Object implements ReceiveStreamListener

Fields Summary
Constructors Summary
Methods Summary
public voidupdate(javax.media.rtp.event.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;
            }
        }