From 849870479421a59e414e4939757e24fb323dddeb Mon Sep 17 00:00:00 2001 From: Marius Melzer Date: Sat, 20 Jun 2020 20:06:14 +0200 Subject: [PATCH 1/3] Add TURN support The TURN server url can be set via environment variable VUE_APP_TURN_URL. --- README.md | 4 ++++ src/config.js | 1 + src/views/Room.vue | 17 +++++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7a0287e..615edd8 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ Sets the location to the palava signaling server. By default, it tries to reach The (required) [STUN server](https://en.wikipedia.org/wiki/STUN) to use, defaults to `stun: stun:stun.palava.tv` +### `VUE_APP_STUN_URL` + +The (optional) [TURN server](https://en.wikipedia.org/wiki/TURN) to use. + ### `BUILD_NOT_MINIFIED` When set, the production build will not be minified. diff --git a/src/config.js b/src/config.js index e8ed65d..8452d1e 100644 --- a/src/config.js +++ b/src/config.js @@ -2,6 +2,7 @@ export default { env: { rtcUrl: process.env.VUE_APP_RTC_URL, stunUrl: process.env.VUE_APP_STUN_URL, + turnUrl: process.env.VUE_APP_TURN_URL, }, defaultRtcUrl: 'ws://localhost:4233', defaultStunUrl: 'stun:stun.palava.tv', diff --git a/src/views/Room.vue b/src/views/Room.vue index 5e93af4..0fee2e3 100644 --- a/src/views/Room.vue +++ b/src/views/Room.vue @@ -54,14 +54,15 @@ export default { created() { const roomId = this.$route.params.roomId this.catchInvalidRoomId(roomId) - this.rtc = this.setupRtc( - new Session({ - roomId, - webSocketAddress: config.env.rtcUrl || config.defaultRtcUrl, - stun: config.env.stunUrl || config.defaultStunUrl, - joinTimeout: config.defaultJoinTimeout, - }) - ) + + const sessionConfig = { + webSocketAddress: config.env.rtcUrl || config.defaultRtcUrl, + stun: config.env.stunUrl || config.defaultStunUrl, + joinTimeout: config.defaultJoinTimeout, + } + if (config.env.turnUrl) { sessionConfig.turn = config.env.turnUrl } + + this.rtc = this.setupRtc(new Session(roomId, sessionConfig)) }, beforeDestroy() { this.rtc.destroy() From 8e395bbbde2e0179f270b9b94a24104f9bd42a67 Mon Sep 17 00:00:00 2001 From: Jan Lelis Date: Sun, 21 Jun 2020 20:31:44 +0200 Subject: [PATCH 2/3] README fixes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 615edd8..8ae324a 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ Sets the location to the palava signaling server. By default, it tries to reach ### `VUE_APP_STUN_URL` -The (required) [STUN server](https://en.wikipedia.org/wiki/STUN) to use, defaults to `stun: stun:stun.palava.tv` +The (required) [STUN server](https://en.wikipedia.org/wiki/STUN) to use, defaults to `stun:stun:stun.palava.tv` -### `VUE_APP_STUN_URL` +### `VUE_APP_TURN_URL` The (optional) [TURN server](https://en.wikipedia.org/wiki/TURN) to use. From d527dfa1c7968dd4f9ea4cfb8a729754ed7d85cd Mon Sep 17 00:00:00 2001 From: Jan Lelis Date: Sun, 21 Jun 2020 22:02:12 +0200 Subject: [PATCH 3/3] Fix session initalization --- src/views/Room.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/Room.vue b/src/views/Room.vue index 0fee2e3..297106a 100644 --- a/src/views/Room.vue +++ b/src/views/Room.vue @@ -56,13 +56,17 @@ export default { this.catchInvalidRoomId(roomId) const sessionConfig = { + roomId, webSocketAddress: config.env.rtcUrl || config.defaultRtcUrl, stun: config.env.stunUrl || config.defaultStunUrl, joinTimeout: config.defaultJoinTimeout, } - if (config.env.turnUrl) { sessionConfig.turn = config.env.turnUrl } - this.rtc = this.setupRtc(new Session(roomId, sessionConfig)) + if (config.env.turnUrl) { + sessionConfig.turn = config.env.turnUrl + } + + this.rtc = this.setupRtc(new Session(sessionConfig)) }, beforeDestroy() { this.rtc.destroy()