mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: Add cutomIceServers from 'joinRoom' rpc message
parent
0437cc9199
commit
40ed2c5efc
|
@ -1510,7 +1510,19 @@ export class Session extends EventDispatcher {
|
||||||
|
|
||||||
private processJoinRoomResponse(opts: LocalConnectionOptions) {
|
private processJoinRoomResponse(opts: LocalConnectionOptions) {
|
||||||
this.sessionId = opts.session;
|
this.sessionId = opts.session;
|
||||||
if (opts.coturnIp != null && opts.coturnPort != null && opts.turnUsername != null && opts.turnCredential != null) {
|
if (opts.customIceServers != null && opts.customIceServers.length > 0) {
|
||||||
|
this.openvidu.iceServers = [];
|
||||||
|
for(const iceServer of opts.customIceServers) {
|
||||||
|
let rtcIceServer: RTCIceServer = {
|
||||||
|
urls: [ iceServer.url ]
|
||||||
|
}
|
||||||
|
if (iceServer.username != null && iceServer.credential != null) {
|
||||||
|
rtcIceServer.username = iceServer.username;
|
||||||
|
rtcIceServer.credential = iceServer.credential;
|
||||||
|
}
|
||||||
|
this.openvidu.iceServers.push(rtcIceServer);
|
||||||
|
}
|
||||||
|
} else if (opts.coturnIp != null && opts.coturnPort != null && opts.turnUsername != null && opts.turnCredential != null) {
|
||||||
const turnUrl1 = 'turn:' + opts.coturnIp + ':' + opts.coturnPort;
|
const turnUrl1 = 'turn:' + opts.coturnIp + ':' + opts.coturnPort;
|
||||||
this.openvidu.iceServers = [
|
this.openvidu.iceServers = [
|
||||||
{ urls: [turnUrl1], username: opts.turnUsername, credential: opts.turnCredential }
|
{ urls: [turnUrl1], username: opts.turnUsername, credential: opts.turnCredential }
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* (C) Copyright 2017-2022 OpenVidu (https://openvidu.io)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export interface IceServerProperties {
|
||||||
|
url: string;
|
||||||
|
username?: string;
|
||||||
|
credential?: string;
|
||||||
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { RemoteConnectionOptions } from './RemoteConnectionOptions';
|
import { RemoteConnectionOptions } from './RemoteConnectionOptions';
|
||||||
|
import { IceServerProperties } from './IceServerProperties';
|
||||||
|
|
||||||
export interface LocalConnectionOptions {
|
export interface LocalConnectionOptions {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -35,4 +36,5 @@ export interface LocalConnectionOptions {
|
||||||
mediaServer: string;
|
mediaServer: string;
|
||||||
videoSimulcast: boolean;
|
videoSimulcast: boolean;
|
||||||
life: number;
|
life: number;
|
||||||
|
customIceServers?: IceServerProperties[]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue