openvidu-browser and openvidu-server version check
This commit is contained in:
parent
43e5f3e741
commit
e07583f0b9
556
openvidu-browser/npm-shrinkwrap.json
generated
556
openvidu-browser/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,8 @@ import RpcBuilder = require('../OpenViduInternal/KurentoUtils/kurento-jsonrpc');
|
||||
import platform = require('platform');
|
||||
platform['isIonicIos'] = (platform.product === 'iPhone' || platform.product === 'iPad') && platform.ua!!.indexOf('Safari') === -1;
|
||||
|
||||
const packageJson = require('../../package.json');
|
||||
|
||||
/**
|
||||
* Entrypoint of OpenVidu Browser library.
|
||||
* Use it to initialize objects of type [[Session]], [[Publisher]] and [[LocalRecorder]]
|
||||
@ -81,9 +83,16 @@ export class OpenVidu {
|
||||
* @hidden
|
||||
*/
|
||||
webrtcStatsInterval: number = 0;
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
libraryVersion: string;
|
||||
|
||||
constructor() {
|
||||
this.libraryVersion = packageJson.version;
|
||||
|
||||
console.info("'OpenVidu' initialized");
|
||||
console.info("openvidu-browser version: " + this.libraryVersion);
|
||||
|
||||
if (platform.os!!.family === 'iOS' || platform.os!!.family === 'Android') {
|
||||
// Listen to orientationchange only on mobile devices
|
||||
|
||||
@ -1145,6 +1145,7 @@ export class Session implements EventDispatcher {
|
||||
const turnCredential = url.searchParams.get('turnCredential');
|
||||
const role = url.searchParams.get('role');
|
||||
const webrtcStatsInterval = url.searchParams.get('webrtcStatsInterval');
|
||||
const openviduServerVersion = url.searchParams.get('version');
|
||||
|
||||
if (!!secret) {
|
||||
this.openvidu.secret = secret;
|
||||
@ -1168,6 +1169,14 @@ export class Session implements EventDispatcher {
|
||||
if (!!webrtcStatsInterval) {
|
||||
this.openvidu.webrtcStatsInterval = +webrtcStatsInterval;
|
||||
}
|
||||
if (!!openviduServerVersion) {
|
||||
console.info("openvidu-server version: " + openviduServerVersion);
|
||||
if (openviduServerVersion !== this.openvidu.libraryVersion) {
|
||||
console.error('OpenVidu Server (' + openviduServerVersion +
|
||||
') and OpenVidu Browser (' + this.openvidu.libraryVersion +
|
||||
') versions do NOT match. There may be incompatibilities')
|
||||
}
|
||||
}
|
||||
|
||||
this.openvidu.wsUri = 'wss://' + url.host + '/openvidu';
|
||||
this.openvidu.httpUri = 'https://' + url.host;
|
||||
|
||||
@ -222,7 +222,11 @@ public class OpenviduConfig {
|
||||
}
|
||||
|
||||
public String getOpenViduServerVersion() {
|
||||
return this.buildProperties.get("version.openvidu.server");
|
||||
String v = this.buildProperties.get("version.openvidu.server");
|
||||
if (v == null) {
|
||||
v = this.getVersion();
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
|
||||
@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import io.openvidu.java.client.OpenViduRole;
|
||||
import io.openvidu.server.OpenViduServer;
|
||||
import io.openvidu.server.config.OpenviduConfig;
|
||||
import io.openvidu.server.coturn.CoturnCredentialsService;
|
||||
import io.openvidu.server.coturn.TurnCredentials;
|
||||
import io.openvidu.server.kurento.core.KurentoTokenOptions;
|
||||
@ -31,6 +32,9 @@ public class TokenGeneratorDefault implements TokenGenerator {
|
||||
@Autowired
|
||||
private CoturnCredentialsService coturnCredentialsService;
|
||||
|
||||
@Autowired
|
||||
protected OpenviduConfig openviduConfig;
|
||||
|
||||
@Override
|
||||
public Token generateToken(String sessionId, OpenViduRole role, String serverMetadata,
|
||||
KurentoTokenOptions kurentoTokenOptions) {
|
||||
@ -38,6 +42,7 @@ public class TokenGeneratorDefault implements TokenGenerator {
|
||||
token += "?sessionId=" + sessionId;
|
||||
token += "&token=" + RandomStringGenerator.generateRandomChain();
|
||||
token += "&role=" + role.name();
|
||||
token += "&version=" + openviduConfig.getOpenViduServerVersion();
|
||||
TurnCredentials turnCredentials = null;
|
||||
if (this.coturnCredentialsService.isCoturnAvailable()) {
|
||||
turnCredentials = coturnCredentialsService.createUser();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user