mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser now allows OpenVidu initialization without URL (ngrok support)
parent
dbe48b543b
commit
c1410a6f82
File diff suppressed because one or more lines are too long
|
@ -29,8 +29,14 @@ export class OpenVidu {
|
|||
|
||||
openVidu: OpenViduInternal;
|
||||
|
||||
constructor(private wsUri: string) {
|
||||
constructor();
|
||||
constructor(wsUri: string);
|
||||
constructor(wsUri?: string) {
|
||||
if (wsUri) {
|
||||
this.openVidu = new OpenViduInternal(wsUri);
|
||||
} else {
|
||||
this.openVidu = new OpenViduInternal();
|
||||
}
|
||||
}
|
||||
|
||||
initSession(apiKey: string, sessionId: string): Session;
|
||||
|
|
|
@ -22,6 +22,7 @@ export type Callback<T> = (error?: any, openVidu?: T) => void;
|
|||
|
||||
export class OpenViduInternal {
|
||||
|
||||
private wsUri;
|
||||
private session: SessionInternal;
|
||||
private jsonRpcClient: any;
|
||||
private rpcParams: any;
|
||||
|
@ -29,13 +30,18 @@ export class OpenViduInternal {
|
|||
private camera: Stream;
|
||||
private remoteStreams: Stream[] = [];
|
||||
|
||||
constructor(private wsUri: string) {
|
||||
constructor();
|
||||
constructor(wsUri: string);
|
||||
constructor(wsUri?: string) {
|
||||
if (wsUri) {
|
||||
this.wsUri = wsUri;
|
||||
if (this.wsUri.charAt(wsUri.length - 1) != '/') {
|
||||
this.wsUri += '/';
|
||||
}
|
||||
this.checkNgrokUri();
|
||||
this.wsUri += 'room';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkNgrokUri() {
|
||||
|
@ -113,7 +119,13 @@ export class OpenViduInternal {
|
|||
}
|
||||
/* NEW METHODS */
|
||||
|
||||
getWsUri() {
|
||||
return this.wsUri;
|
||||
}
|
||||
|
||||
setWsUri(wsUri: string) {
|
||||
this.wsUri = wsUri;
|
||||
}
|
||||
|
||||
getOpenViduServerURL() {
|
||||
return 'https://' + this.wsUri.split("wss://")[1].split("/room")[0];
|
||||
|
|
|
@ -28,6 +28,9 @@ export class SessionInternal {
|
|||
|
||||
constructor(private openVidu: OpenViduInternal, private sessionId: string) {
|
||||
this.localParticipant = new Connection(this.openVidu, true, this);
|
||||
if (!this.openVidu.getWsUri()) {
|
||||
this.openVidu.setWsUri(this.sessionId.substring(0, this.sessionId.lastIndexOf('/')) + '/room');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue