// create the RTPSocket
rtpsocket = new RTPSocket();
// set its content type :
// rtpraw/video for a video session
// rtpraw/audio for an audio session
String content = "rtpraw/" + media;
rtpsocket.setContentType(content);
// set the RTP Session address and port of the RTP data
rtp = new UDPHandler(address, port);
// set the above UDP Handler to be the
// sourcestream of the rtpsocket
rtpsocket.setOutputStream(rtp);
// set the RTP Session address and port of the RTCP data
rtcp = new UDPHandler(address, port +1);
// get a handle over the RTCP Datasource so that we can
// set the sourcestream and deststream of this source
// to the rtcp udp handler we created above.
rtcpsource = rtpsocket.getControlChannel();
// Since we intend to send RTCP packets from the
// network to the session manager and vice-versa, we need
// to set the RTCP UDP handler as both the input and output
// stream of the rtcpsource.
rtcpsource.setOutputStream(rtcp);
rtcpsource.setInputStream(rtcp);
// connect the RTP socket data source before
// creating the player
try {
rtpsocket.connect();
player = Manager.createPlayer(rtpsocket);
rtpsocket.start();
} catch (NoPlayerException e) {
System.err.println(e.getMessage());
e.printStackTrace();
return;
}
catch (IOException e) {
System.err.println(e.getMessage());
e.printStackTrace();
return;
}
if (player != null) {
player.addControllerListener(this);
// send this player to out playerwindow
// playerWindow = new PlayerWindow(player);
}