mirror of https://github.com/OpenVidu/openvidu.git
Retrocompatibility with 2.15.0 with openvidu-server version on joinRoom
parent
2d6dfb2363
commit
243dfcee67
|
@ -142,7 +142,7 @@ export class Connection {
|
||||||
};
|
};
|
||||||
// TODO: CLEAN 2.15.0 LEGACY CODE
|
// TODO: CLEAN 2.15.0 LEGACY CODE
|
||||||
// THIS LINE:
|
// THIS LINE:
|
||||||
const stream = this.session.openvidu.openviduServerVersion.startsWith('2.16') ? new Stream(this.session, streamOptions) : new StreamLEGACY(this.session, streamOptions);
|
const stream = !this.session.openvidu.openviduServerVersion ? /*2.15.0 (LEGACY)*/ new StreamLEGACY(this.session, streamOptions) : /*2.16.0 (NORMAL API)*/ new Stream(this.session, streamOptions);
|
||||||
// SHOULD GET BACK TO:
|
// SHOULD GET BACK TO:
|
||||||
// const stream = new Stream(this.session, streamOptions);
|
// const stream = new Stream(this.session, streamOptions);
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ export class Publisher extends StreamManager {
|
||||||
|
|
||||||
// TODO: CLEAN 2.15.0 LEGACY CODE
|
// TODO: CLEAN 2.15.0 LEGACY CODE
|
||||||
// THIS LINE:
|
// THIS LINE:
|
||||||
super(openvidu.openviduServerVersion.startsWith('2.16') ? new Stream((!!openvidu.session) ? openvidu.session : new Session(openvidu), { publisherProperties: properties, mediaConstraints: {} }) : new StreamLEGACY((!!openvidu.session) ? openvidu.session : new Session(openvidu), { publisherProperties: properties, mediaConstraints: {} }), targEl);
|
super(!openvidu.openviduServerVersion ? /*2.15.0 or 2.16.0 NOT CONNECTED (LEGACY)*/ new StreamLEGACY((!!openvidu.session) ? openvidu.session : new Session(openvidu), { publisherProperties: properties, mediaConstraints: {} }) : /*2.16.0 CONNECTED (NORMAL API)*/ new Stream(openvidu.session, { publisherProperties: properties, mediaConstraints: {} }), targEl);
|
||||||
// SHOULD GET BACK TO:
|
// SHOULD GET BACK TO:
|
||||||
// super(new Stream((!!openvidu.session) ? openvidu.session : new Session(openvidu), { publisherProperties: properties, mediaConstraints: {} }), targEl);
|
// super(new Stream((!!openvidu.session) ? openvidu.session : new Session(openvidu), { publisherProperties: properties, mediaConstraints: {} }), targEl);
|
||||||
|
|
||||||
|
|
|
@ -1154,6 +1154,7 @@ export class Session extends EventDispatcher {
|
||||||
|
|
||||||
// Initialize local Connection object with values returned by openvidu-server
|
// Initialize local Connection object with values returned by openvidu-server
|
||||||
this.connection = new Connection(this);
|
this.connection = new Connection(this);
|
||||||
|
this.openvidu.openviduServerVersion = response.openviduServerVersion;
|
||||||
this.connection.connectionId = response.id;
|
this.connection.connectionId = response.id;
|
||||||
this.connection.creationTime = response.createdAt;
|
this.connection.creationTime = response.createdAt;
|
||||||
this.connection.data = response.metadata;
|
this.connection.data = response.metadata;
|
||||||
|
@ -1312,7 +1313,6 @@ export class Session extends EventDispatcher {
|
||||||
|
|
||||||
this.openvidu.wsUri = 'wss://' + url.host + '/openvidu';
|
this.openvidu.wsUri = 'wss://' + url.host + '/openvidu';
|
||||||
this.openvidu.httpUri = 'https://' + url.host;
|
this.openvidu.httpUri = 'https://' + url.host;
|
||||||
this.openvidu.openviduServerVersion = openviduServerVersion;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.error('Token "' + token + '" is not valid')
|
logger.error('Token "' + token + '" is not valid')
|
||||||
|
|
|
@ -42,6 +42,13 @@ export class StreamLEGACY extends Stream {
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
initWebRtcPeerSend(reconnect: boolean): Promise<any> {
|
initWebRtcPeerSend(reconnect: boolean): Promise<any> {
|
||||||
|
|
||||||
|
if (!!this.session.openvidu.openviduServerVersion) {
|
||||||
|
// 2.16.0
|
||||||
|
return super.initWebRtcPeerSend(reconnect);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 2.15.0
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
if (!reconnect) {
|
if (!reconnect) {
|
||||||
|
@ -139,12 +146,21 @@ export class StreamLEGACY extends Stream {
|
||||||
reject(new Error('(publish) SDP offer error: ' + JSON.stringify(error)));
|
reject(new Error('(publish) SDP offer error: ' + JSON.stringify(error)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
initWebRtcPeerReceive(reconnect: boolean): Promise<any> {
|
initWebRtcPeerReceive(reconnect: boolean): Promise<any> {
|
||||||
|
|
||||||
|
if (!!this.session.openvidu.openviduServerVersion) {
|
||||||
|
// 2.16.0
|
||||||
|
return super.initWebRtcPeerReceive(reconnect);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 2.15.0
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
const offerConstraints = {
|
const offerConstraints = {
|
||||||
|
@ -206,12 +222,21 @@ export class StreamLEGACY extends Stream {
|
||||||
reject(new Error('(subscribe) SDP offer error: ' + JSON.stringify(error)));
|
reject(new Error('(subscribe) SDP offer error: ' + JSON.stringify(error)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
remotePeerSuccessfullyEstablished(): void {
|
remotePeerSuccessfullyEstablished(): void {
|
||||||
|
|
||||||
|
if (!!this.session.openvidu.openviduServerVersion) {
|
||||||
|
// 2.16.0
|
||||||
|
super.remotePeerSuccessfullyEstablished();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 2.15.0
|
||||||
this.mediaStream = new MediaStream();
|
this.mediaStream = new MediaStream();
|
||||||
let receiver: RTCRtpReceiver;
|
let receiver: RTCRtpReceiver;
|
||||||
for (receiver of this.webRtcPeer.pc.getReceivers()) {
|
for (receiver of this.webRtcPeer.pc.getReceivers()) {
|
||||||
|
@ -238,6 +263,8 @@ export class StreamLEGACY extends Stream {
|
||||||
this.updateMediaStreamInVideos();
|
this.updateMediaStreamInVideos();
|
||||||
this.initHarkEvents(); // Init hark events for the remote stream
|
this.initHarkEvents(); // Init hark events for the remote stream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -41,6 +41,7 @@ public class ProtocolElements {
|
||||||
public static final String JOINROOM_RECORDER_PARAM = "recorder";
|
public static final String JOINROOM_RECORDER_PARAM = "recorder";
|
||||||
|
|
||||||
public static final String JOINROOM_PEERID_PARAM = "id";
|
public static final String JOINROOM_PEERID_PARAM = "id";
|
||||||
|
public static final String JOINROOM_OPENVIDUSERVERVERSION_PARAM = "openviduServerVersion";
|
||||||
public static final String JOINROOM_PEERCREATEDAT_PARAM = "createdAt";
|
public static final String JOINROOM_PEERCREATEDAT_PARAM = "createdAt";
|
||||||
public static final String JOINROOM_PEERSTREAMS_PARAM = "streams";
|
public static final String JOINROOM_PEERSTREAMS_PARAM = "streams";
|
||||||
public static final String JOINROOM_PEERSTREAMID_PARAM = "id";
|
public static final String JOINROOM_PEERSTREAMID_PARAM = "id";
|
||||||
|
|
|
@ -40,6 +40,7 @@ import io.openvidu.client.internal.ProtocolElements;
|
||||||
import io.openvidu.java.client.OpenViduRole;
|
import io.openvidu.java.client.OpenViduRole;
|
||||||
import io.openvidu.server.cdr.CallDetailRecord;
|
import io.openvidu.server.cdr.CallDetailRecord;
|
||||||
import io.openvidu.server.config.InfoHandler;
|
import io.openvidu.server.config.InfoHandler;
|
||||||
|
import io.openvidu.server.config.OpenviduBuildInfo;
|
||||||
import io.openvidu.server.config.OpenviduConfig;
|
import io.openvidu.server.config.OpenviduConfig;
|
||||||
import io.openvidu.server.kurento.core.KurentoParticipant;
|
import io.openvidu.server.kurento.core.KurentoParticipant;
|
||||||
import io.openvidu.server.kurento.endpoint.KurentoFilter;
|
import io.openvidu.server.kurento.endpoint.KurentoFilter;
|
||||||
|
@ -62,6 +63,9 @@ public class SessionEventsHandler {
|
||||||
@Autowired
|
@Autowired
|
||||||
protected OpenviduConfig openviduConfig;
|
protected OpenviduConfig openviduConfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected OpenviduBuildInfo openviduBuildConfig;
|
||||||
|
|
||||||
Map<String, Recording> recordingsStarted = new ConcurrentHashMap<>();
|
Map<String, Recording> recordingsStarted = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
ReentrantLock lock = new ReentrantLock();
|
ReentrantLock lock = new ReentrantLock();
|
||||||
|
@ -156,6 +160,8 @@ public class SessionEventsHandler {
|
||||||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_USER_PARAM, participant.getParticipantPublicId());
|
result.addProperty(ProtocolElements.PARTICIPANTJOINED_USER_PARAM, participant.getParticipantPublicId());
|
||||||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_CREATEDAT_PARAM, participant.getCreatedAt());
|
result.addProperty(ProtocolElements.PARTICIPANTJOINED_CREATEDAT_PARAM, participant.getCreatedAt());
|
||||||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_METADATA_PARAM, participant.getFullMetadata());
|
result.addProperty(ProtocolElements.PARTICIPANTJOINED_METADATA_PARAM, participant.getFullMetadata());
|
||||||
|
result.addProperty(ProtocolElements.JOINROOM_OPENVIDUSERVERVERSION_PARAM,
|
||||||
|
openviduBuildConfig.getOpenViduServerVersion());
|
||||||
result.add("value", resultArray);
|
result.add("value", resultArray);
|
||||||
|
|
||||||
rpcNotificationService.sendResponse(participant.getParticipantPrivateId(), transactionId, result);
|
rpcNotificationService.sendResponse(participant.getParticipantPrivateId(), transactionId, result);
|
||||||
|
|
Loading…
Reference in New Issue