Skip to content

Commit

Permalink
Merge pull request #59 from palavatv/turn
Browse files Browse the repository at this point in the history
Add TURN support
  • Loading branch information
farao authored Jun 25, 2020
2 parents 32b5eb1 + d527dfa commit 7017628
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ 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_TURN_URL`

The (optional) [TURN server](https://en.wikipedia.org/wiki/TURN) to use.

### `BUILD_NOT_MINIFIED`

Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
21 changes: 13 additions & 8 deletions src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ 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 = {
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(sessionConfig))
},
beforeDestroy() {
this.rtc.destroy()
Expand Down

0 comments on commit 7017628

Please sign in to comment.