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
|
||||
// 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:
|
||||
// const stream = new Stream(this.session, streamOptions);
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ export class Publisher extends StreamManager {
|
|||
|
||||
// TODO: CLEAN 2.15.0 LEGACY CODE
|
||||
// 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:
|
||||
// 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
|
||||
this.connection = new Connection(this);
|
||||
this.openvidu.openviduServerVersion = response.openviduServerVersion;
|
||||
this.connection.connectionId = response.id;
|
||||
this.connection.creationTime = response.createdAt;
|
||||
this.connection.data = response.metadata;
|
||||
|
@ -1312,7 +1313,6 @@ export class Session extends EventDispatcher {
|
|||
|
||||
this.openvidu.wsUri = 'wss://' + url.host + '/openvidu';
|
||||
this.openvidu.httpUri = 'https://' + url.host;
|
||||
this.openvidu.openviduServerVersion = openviduServerVersion;
|
||||
|
||||
} else {
|
||||
logger.error('Token "' + token + '" is not valid')
|
||||
|
|
|
@ -42,6 +42,13 @@ export class StreamLEGACY extends Stream {
|
|||
* @hidden
|
||||
*/
|
||||
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) => {
|
||||
|
||||
if (!reconnect) {
|
||||
|
@ -139,12 +146,21 @@ export class StreamLEGACY extends Stream {
|
|||
reject(new Error('(publish) SDP offer error: ' + JSON.stringify(error)));
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
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) => {
|
||||
|
||||
const offerConstraints = {
|
||||
|
@ -206,12 +222,21 @@ export class StreamLEGACY extends Stream {
|
|||
reject(new Error('(subscribe) SDP offer error: ' + JSON.stringify(error)));
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
remotePeerSuccessfullyEstablished(): void {
|
||||
|
||||
if (!!this.session.openvidu.openviduServerVersion) {
|
||||
// 2.16.0
|
||||
super.remotePeerSuccessfullyEstablished();
|
||||
|
||||
} else {
|
||||
// 2.15.0
|
||||
this.mediaStream = new MediaStream();
|
||||
let receiver: RTCRtpReceiver;
|
||||
for (receiver of this.webRtcPeer.pc.getReceivers()) {
|
||||
|
@ -238,6 +263,8 @@ export class StreamLEGACY extends Stream {
|
|||
this.updateMediaStreamInVideos();
|
||||
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_PEERID_PARAM = "id";
|
||||
public static final String JOINROOM_OPENVIDUSERVERVERSION_PARAM = "openviduServerVersion";
|
||||
public static final String JOINROOM_PEERCREATEDAT_PARAM = "createdAt";
|
||||
public static final String JOINROOM_PEERSTREAMS_PARAM = "streams";
|
||||
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.server.cdr.CallDetailRecord;
|
||||
import io.openvidu.server.config.InfoHandler;
|
||||
import io.openvidu.server.config.OpenviduBuildInfo;
|
||||
import io.openvidu.server.config.OpenviduConfig;
|
||||
import io.openvidu.server.kurento.core.KurentoParticipant;
|
||||
import io.openvidu.server.kurento.endpoint.KurentoFilter;
|
||||
|
@ -62,6 +63,9 @@ public class SessionEventsHandler {
|
|||
@Autowired
|
||||
protected OpenviduConfig openviduConfig;
|
||||
|
||||
@Autowired
|
||||
protected OpenviduBuildInfo openviduBuildConfig;
|
||||
|
||||
Map<String, Recording> recordingsStarted = new ConcurrentHashMap<>();
|
||||
|
||||
ReentrantLock lock = new ReentrantLock();
|
||||
|
@ -156,6 +160,8 @@ public class SessionEventsHandler {
|
|||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_USER_PARAM, participant.getParticipantPublicId());
|
||||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_CREATEDAT_PARAM, participant.getCreatedAt());
|
||||
result.addProperty(ProtocolElements.PARTICIPANTJOINED_METADATA_PARAM, participant.getFullMetadata());
|
||||
result.addProperty(ProtocolElements.JOINROOM_OPENVIDUSERVERVERSION_PARAM,
|
||||
openviduBuildConfig.getOpenViduServerVersion());
|
||||
result.add("value", resultArray);
|
||||
|
||||
rpcNotificationService.sendResponse(participant.getParticipantPrivateId(), transactionId, result);
|
||||
|
|
Loading…
Reference in New Issue