handlerDataCallback.pushHandlerData(data);
};
WebRTC.DataType dataType = topic.endsWith(Definitions.RESPONSE_POSTFIX) ? WebRTC.DataType.MESSAGE : WebRTC.DataType.VIDEOFRAME;
- ws = new WebRTCServer(appContext, dataType, cb);
+ ws = new WebRTCServer(appContext, cb);
int serverPort = ws.start();
if (serverPort < 0) {
throw new IllegalArgumentException("Failed to start webRTC server-socket");
public void publish(String topic, String ip, int port, byte[] message) {
WebRTC.DataType dataType = topic.endsWith(Definitions.RESPONSE_POSTFIX) ? WebRTC.DataType.MESSAGE : WebRTC.DataType.VIDEOFRAME;
if (webrtc == null) {
- webrtc = new WebRTC(dataType, appContext);
+ webrtc = new WebRTC(appContext);
webrtc.connect(ip, port);
}
if (dataType == WebRTC.DataType.MESSAGE) {
/**
* WebRTC constructor to create webRTC instance
- * @param dataType To decide webRTC channel type
* @param appContext Application context creating webRTC instance
*/
- public WebRTC(DataType dataType , Context appContext) {
+ public WebRTC(Context appContext) {
this.appContext = appContext;
this.isReciever = false;
}
/**
* WebRTC constructor to create webRTC instance
- * @param dataType To decide webRTC channel type
* @param appContext Application context creating webRTC instance
* @param socket Java server socket for webrtc signalling
*/
- WebRTC(DataType dataType , Context appContext , Socket socket) {
+ WebRTC(Context appContext , Socket socket) {
Log.d(TAG , "InWebRTC Constructor");
this.appContext = appContext;
this.socket = socket;
*/
public class WebRTCServer {
private static final String TAG = "WebRTCServer";
- private WebRTC.DataType dataType;
private ServerSocket serverSocket = null;
private Context appContext;
private WebRTC.ReceiveDataCallback dataCallback;
/**
* WebRTCServer constructor to create its instance
* @param appContext Application context of the app creating WebRTCServer instance
- * @param dataType Datatype to create webRTC channel - Media channel or data channel
* @param dataCallback Data callback object to create call back mechanism
*/
- public WebRTCServer(Context appContext, WebRTC.DataType dataType, WebRTC.ReceiveDataCallback dataCallback){
+ public WebRTCServer(Context appContext, WebRTC.ReceiveDataCallback dataCallback){
this.appContext = appContext;
- this.dataType = dataType;
this.dataCallback = dataCallback;
}
while(isRunning){
try {
Socket socket = serverSocket.accept();
- WebRTC web = new WebRTC(dataType , appContext , socket);
+ WebRTC web = new WebRTC(appContext , socket);
web.connect();
web.registerDataCallback(dataCallback);
connectionList.add(web);