diff --git a/openvidu-browser/ts/KurentoUtils/kurento-utils-js/WebRtcPeer.js b/openvidu-browser/ts/KurentoUtils/kurento-utils-js/WebRtcPeer.js index b76e577b..41abfa45 100644 --- a/openvidu-browser/ts/KurentoUtils/kurento-utils-js/WebRtcPeer.js +++ b/openvidu-browser/ts/KurentoUtils/kurento-utils-js/WebRtcPeer.js @@ -203,9 +203,9 @@ function WebRtcPeer(mode, options, callback) { var pc = options.peerConnection var sendSource = options.sendSource || 'webcam' - var dataChannelConfig = options.dataChannelConfig + /*var dataChannelConfig = options.dataChannelConfig var useDataChannels = options.dataChannels || false - var dataChannel + var dataChannel*/ var guid = uuid.v4() var configuration = recursive({ @@ -251,11 +251,11 @@ function WebRtcPeer(mode, options, callback) { } }, - 'dataChannel': { + /*'dataChannel': { get: function () { return dataChannel } - }, + },*/ /** * @member {(external:ImageData|undefined)} currentFrame @@ -283,7 +283,7 @@ function WebRtcPeer(mode, options, callback) { // Init PeerConnection if (!pc) { pc = new RTCPeerConnection(configuration); - if (useDataChannels && !dataChannel) { + /*if (useDataChannels && !dataChannel) { var dcId = 'WebRtcPeer-' + self.id var dcOptions = undefined if (dataChannelConfig) { @@ -298,7 +298,7 @@ function WebRtcPeer(mode, options, callback) { dataChannel.onbufferedamountlow = dataChannelConfig.onbufferedamountlow; dataChannel.onerror = dataChannelConfig.onerror || noop; } - } + }*/ } pc.addEventListener('icecandidate', function (event) { @@ -438,14 +438,14 @@ function WebRtcPeer(mode, options, callback) { localVideo.muted = true } - this.send = function (data) { + /*this.send = function (data) { if (dataChannel && dataChannel.readyState === 'open') { dataChannel.send(data) } else { logger.warn( 'Trying to send data over a non-existing or closed data channel') } - } + }*/ /** * Callback function invoked when a SDP answer is received. Developers are @@ -706,13 +706,13 @@ WebRtcPeer.prototype.dispose = function () { logger.debug('Disposing WebRtcPeer') var pc = this.peerConnection - var dc = this.dataChannel + //var dc = this.dataChannel try { - if (dc) { + /*if (dc) { if (dc.signalingState === 'closed') return dc.close() - } + }*/ if (pc) { if (pc.signalingState === 'closed') return diff --git a/openvidu-browser/ts/OpenVidu/OpenVidu.ts b/openvidu-browser/ts/OpenVidu/OpenVidu.ts index 259a735d..55dc2730 100644 --- a/openvidu-browser/ts/OpenVidu/OpenVidu.ts +++ b/openvidu-browser/ts/OpenVidu/OpenVidu.ts @@ -72,7 +72,6 @@ export class OpenVidu { sendVideo: cameraOptions.video != null ? cameraOptions.video : true, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, - dataChannel: true, mediaConstraints: this.openVidu.generateMediaConstraints(cameraOptions) }; cameraOptions = cameraOptionsAux; @@ -94,7 +93,6 @@ export class OpenVidu { sendVideo: cameraOptions.video, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, - dataChannel: true, mediaConstraints: { video: screenConstraints.video, audio: false @@ -152,7 +150,6 @@ export class OpenVidu { sendVideo: cameraOptions.video != null ? cameraOptions.video : true, activeAudio: cameraOptions.audioActive != null ? cameraOptions.audioActive : true, activeVideo: cameraOptions.videoActive != null ? cameraOptions.videoActive : true, - dataChannel: true, mediaConstraints: { video: screenConstraints.video, audio: false @@ -179,7 +176,6 @@ export class OpenVidu { sendVideo: true, activeAudio: true, activeVideo: true, - dataChannel: true, mediaConstraints: { audio: true, video: { width: { ideal: 1280 } } diff --git a/openvidu-browser/ts/OpenViduInternal/OpenViduInternal.ts b/openvidu-browser/ts/OpenViduInternal/OpenViduInternal.ts index c337cfb6..3e1d855e 100644 --- a/openvidu-browser/ts/OpenViduInternal/OpenViduInternal.ts +++ b/openvidu-browser/ts/OpenViduInternal/OpenViduInternal.ts @@ -49,7 +49,6 @@ export class OpenViduInternal { sendVideo: true, activeAudio: true, activeVideo: true, - dataChannel: true, mediaConstraints: { audio: true, video: { width: { ideal: 1280 } } diff --git a/openvidu-browser/ts/OpenViduInternal/SessionInternal.ts b/openvidu-browser/ts/OpenViduInternal/SessionInternal.ts index 3a499f38..577052d1 100644 --- a/openvidu-browser/ts/OpenViduInternal/SessionInternal.ts +++ b/openvidu-browser/ts/OpenViduInternal/SessionInternal.ts @@ -126,14 +126,6 @@ export class SessionInternal { metadata: this.options.metadata, secret: this.openVidu.getSecret(), recorder: this.openVidu.getRecorder(), - dataChannels: false - } - - if (this.localParticipant) { - if (Object.keys(this.localParticipant.getStreams()).some(streamId => - this.remoteStreams[streamId].isDataChannelEnabled())) { - joinParams.dataChannels = true; - } } this.openVidu.sendRequest('joinRoom', joinParams, (error, response) => { diff --git a/openvidu-browser/ts/OpenViduInternal/Stream.ts b/openvidu-browser/ts/OpenViduInternal/Stream.ts index 3abc66ea..2461dfe0 100644 --- a/openvidu-browser/ts/OpenViduInternal/Stream.ts +++ b/openvidu-browser/ts/OpenViduInternal/Stream.ts @@ -52,7 +52,6 @@ export interface InboundStreamOptions { export interface OutboundStreamOptions { activeAudio: boolean; activeVideo: boolean; - dataChannel: boolean; mediaConstraints: any; sendAudio: boolean; sendVideo: boolean; @@ -74,7 +73,6 @@ export class Stream { private showMyRemote = false; private localMirrored = false; private chanId = 0; - private dataChannelOpened = false; inboundOptions: InboundStreamOptions; outboundOptions: OutboundStreamOptions; @@ -196,37 +194,6 @@ export class Stream { return this.streamId + '_' + this.chanId++; } - - isDataChannelEnabled() { - return this.outboundOptions.dataChannel; - } - - - isDataChannelOpened() { - return this.dataChannelOpened; - } - - onDataChannelOpen(event) { - console.debug('Data channel is opened'); - this.dataChannelOpened = true; - } - - onDataChannelClosed(event) { - console.debug('Data channel is closed'); - this.dataChannelOpened = false; - } - - sendData(data) { - if (this.wp === undefined) { - throw new Error('WebRTC peer has not been created yet'); - } - if (!this.dataChannelOpened) { - throw new Error('Data channel is not opened'); - } - console.info("Sending through data channel: " + data); - this.wp.send(data); - } - getMediaStream() { return this.mediaStream; } @@ -490,15 +457,6 @@ export class Stream { onicecandidate: this.connection.sendIceCandidate.bind(this.connection), } - if (this.outboundOptions.dataChannel) { - options.dataChannelConfig = { - id: this.getChannelName(), - onopen: this.onDataChannelOpen, - onclose: this.onDataChannelClosed - }; - options.dataChannels = true; - } - if (this.displayMyRemote()) { this.wp = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, error => { if (error) { diff --git a/openvidu-client/src/main/java/io/openvidu/client/OpenViduClient.java b/openvidu-client/src/main/java/io/openvidu/client/OpenViduClient.java index 1af64efe..ceb88c05 100644 --- a/openvidu-client/src/main/java/io/openvidu/client/OpenViduClient.java +++ b/openvidu-client/src/main/java/io/openvidu/client/OpenViduClient.java @@ -17,7 +17,6 @@ package io.openvidu.client; import static io.openvidu.client.internal.ProtocolElements.CUSTOMREQUEST_METHOD; -import static io.openvidu.client.internal.ProtocolElements.JOINROOM_DATACHANNELS_PARAM; import static io.openvidu.client.internal.ProtocolElements.JOINROOM_METHOD; import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERID_PARAM; import static io.openvidu.client.internal.ProtocolElements.JOINROOM_PEERSTREAMID_PARAM; @@ -121,14 +120,13 @@ public class OpenViduClient { this.client.close(); } - public Map> joinRoom(String roomName, String userName, Boolean dataChannels) + public Map> joinRoom(String roomName, String userName) throws IOException { + JsonObject params = new JsonObject(); params.addProperty(JOINROOM_ROOM_PARAM, roomName); params.addProperty(JOINROOM_USER_PARAM, userName); - if (dataChannels != null) { - params.addProperty(JOINROOM_DATACHANNELS_PARAM, dataChannels); - } + JsonElement result = client.sendRequest(JOINROOM_METHOD, params); Map> peers = new HashMap>(); JsonArray jsonPeers = JsonRoomUtils.getResponseProperty(result, "value", JsonArray.class); diff --git a/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java b/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java index 4fe9b00e..d56e6cf7 100644 --- a/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java +++ b/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java @@ -38,7 +38,6 @@ public class ProtocolElements { public static final String JOINROOM_SECRET_PARAM = "secret"; public static final String JOINROOM_RECORDER_PARAM = "recorder"; - public static final String JOINROOM_DATACHANNELS_PARAM = "dataChannels"; public static final String JOINROOM_PEERID_PARAM = "id"; public static final String JOINROOM_PEERSTREAMS_PARAM = "streams"; public static final String JOINROOM_PEERSTREAMID_PARAM = "id"; diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoParticipant.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoParticipant.java index 189266c2..4b73d083 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoParticipant.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/core/KurentoParticipant.java @@ -35,7 +35,6 @@ public class KurentoParticipant extends Participant { private InfoHandler infoHandler; - private boolean dataChannels = false; private boolean webParticipant = true; private final KurentoSession session; @@ -52,7 +51,7 @@ public class KurentoParticipant extends Participant { participant.getClientMetadata()); this.session = kurentoSession; this.pipeline = pipeline; - this.publisher = new PublisherEndpoint(webParticipant, dataChannels, this, participant.getParticipantPublicId(), + this.publisher = new PublisherEndpoint(webParticipant, this, participant.getParticipantPublicId(), pipeline); for (Participant other : session.getParticipants()) { @@ -199,7 +198,7 @@ public class KurentoParticipant extends Participant { log.info("PARTICIPANT {}: unpublishing media stream from room {}", this.getParticipantPublicId(), this.session.getSessionId()); releasePublisherEndpoint(); - this.publisher = new PublisherEndpoint(webParticipant, dataChannels, this, this.getParticipantPublicId(), + this.publisher = new PublisherEndpoint(webParticipant, this, this.getParticipantPublicId(), pipeline); log.info( "PARTICIPANT {}: released publisher endpoint and left it initialized (ready for future streaming)", diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java index e62c6cec..75420056 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java @@ -53,7 +53,6 @@ public abstract class MediaEndpoint { private static Logger log; private boolean web = false; - private boolean dataChannels = false; private WebRtcEndpoint webEndpoint = null; private RtpEndpoint endpoint = null; @@ -75,13 +74,12 @@ public abstract class MediaEndpoint { * Constructor to set the owner, the endpoint's name and the media pipeline. * * @param web - * @param dataChannels * @param owner * @param endpointName * @param pipeline * @param log */ - public MediaEndpoint(boolean web, boolean dataChannels, KurentoParticipant owner, String endpointName, + public MediaEndpoint(boolean web, KurentoParticipant owner, String endpointName, MediaPipeline pipeline, Logger log) { if (log == null) { MediaEndpoint.log = LoggerFactory.getLogger(MediaEndpoint.class); @@ -89,7 +87,6 @@ public abstract class MediaEndpoint { MediaEndpoint.log = log; } this.web = web; - this.dataChannels = dataChannels; this.owner = owner; this.setEndpointName(endpointName); this.setMediaPipeline(pipeline); @@ -244,9 +241,9 @@ public abstract class MediaEndpoint { protected void internalEndpointInitialization(final CountDownLatch endpointLatch) { if (this.isWeb()) { WebRtcEndpoint.Builder builder = new WebRtcEndpoint.Builder(pipeline); - if (this.dataChannels) { + /*if (this.dataChannels) { builder.useDataChannels(); - } + }*/ builder.buildAsync(new Continuation() { @Override public void onSuccess(WebRtcEndpoint result) throws Exception { diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java index 20022821..40a250b4 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/PublisherEndpoint.java @@ -55,9 +55,9 @@ public class PublisherEndpoint extends MediaEndpoint { private Map elementsErrorSubscriptions = new HashMap(); - public PublisherEndpoint(boolean web, boolean dataChannels, KurentoParticipant owner, + public PublisherEndpoint(boolean web, KurentoParticipant owner, String endpointName, MediaPipeline pipeline) { - super(web, dataChannels, owner, endpointName, pipeline, log); + super(web, owner, endpointName, pipeline, log); } @Override diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/SubscriberEndpoint.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/SubscriberEndpoint.java index ddff5180..fe841dec 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/SubscriberEndpoint.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/SubscriberEndpoint.java @@ -39,7 +39,7 @@ public class SubscriberEndpoint extends MediaEndpoint { public SubscriberEndpoint(boolean web, KurentoParticipant owner, String endpointName, MediaPipeline pipeline) { - super(web, false, owner, endpointName, pipeline, log); + super(web, owner, endpointName, pipeline, log); } public synchronized String subscribe(String sdpOffer, PublisherEndpoint publisher) {