private SessionManager StartSessionManager(String destaddrstr,
int port,
String media){
// this method create a new RTPSessionMgr and adds this applet
// as a SessionListener, before calling initSession() and startSession()
SessionManager mymgr = new RTPSessionMgr();
if (media.equals("video"))
videomgr = mymgr;
if (media.equals("audio"))
audiomgr = mymgr;
mymgr.addReceiveStreamListener(this);
//if (media.equals("audio"))
// EncodingUtil.Init((SessionManager)mymgr);
// for initSession() we must generate a CNAME and fill in the
// RTP Session address and port
String cname = mymgr.generateCNAME();
String username = "jmf-user";
SessionAddress localaddr = new SessionAddress();
try{
destaddr = InetAddress.getByName(destaddrstr);
}catch (UnknownHostException e){
System.err.println("inetaddress " + e.getMessage());
e.printStackTrace();
}
SessionAddress sessaddr = new SessionAddress(destaddr,
port,
destaddr,
port+1);
SourceDescription[] userdesclist = new SourceDescription[4];
int i;
for(i=0; i< userdesclist.length;i++){
if (i == 0){
userdesclist[i] = new
SourceDescription(SourceDescription.SOURCE_DESC_EMAIL,
"jmf-user@sun.com",
1,
false);
continue;
}
if (i == 1){
userdesclist[i] = new
SourceDescription(SourceDescription.SOURCE_DESC_NAME,
username,
1,
false);
continue;
}
if ( i == 2){
userdesclist[i] = new
SourceDescription(SourceDescription.SOURCE_DESC_CNAME,
cname,
1,
false);
continue;
}
if (i == 3){
userdesclist[i] = new
SourceDescription(SourceDescription.SOURCE_DESC_TOOL,
"JMF RTP Player v2.0",
1,
false);
continue;
}
}// end of for
// call initSession() and startSession() of the RTPsessionManager
try{
mymgr.initSession(localaddr,
mymgr.generateSSRC(),
userdesclist,
0.05,
0.25);
mymgr.startSession(sessaddr,1,null);
}catch (SessionManagerException e){
System.err.println("RTPPlayerApplet: RTPSM Exception " + e.getMessage());
e.printStackTrace();
return null;
}catch (IOException e){