// 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;
}
}