Add TURN support
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jack Hadrill 2021-01-06 05:12:47 +00:00
parent 8561b9c6c6
commit 7312b279ea
3 changed files with 25 additions and 2 deletions

View File

@ -59,5 +59,26 @@ app.provide('trackers', [
'ws://hub.bugout.link:80/announce' 'ws://hub.bugout.link:80/announce'
]) ])
app.provide('rtcConfig', {
iceServers: [
{
urls: [
'stun:stun.l.google.com:19302',
'stun:global.stun.twilio.com:3478'
]
},
{
urls: [
'turn:relay.instant.io:443?transport=udp',
'turn:relay.instant.io:443?transport=tcp',
'turns:relay.instant.io:443?transport=tcp'
],
username: 'relay.instant.io',
credential: 'nepal-cheddar-baize-oleander'
}
],
sdpSemantics: 'unified-plan'
})
// Render to DOM. // Render to DOM.
app.mount('#app') app.mount('#app')

View File

@ -58,6 +58,7 @@ export default {
setup () { setup () {
const toast = useToast() const toast = useToast()
const trackers = inject('trackers') const trackers = inject('trackers')
const rtcConfig = inject('rtcConfig')
var webTorrent = null var webTorrent = null
var wireUpdateHandle = null var wireUpdateHandle = null
const player = ref(null) const player = ref(null)
@ -79,7 +80,7 @@ export default {
const wireStatistics = reactive([]) const wireStatistics = reactive([])
onMounted(() => { onMounted(() => {
webTorrent = new WebTorrent() webTorrent = new WebTorrent({ tracker: { rtcConfig: rtcConfig } })
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {

View File

@ -64,6 +64,7 @@ export default {
const router = useRouter() const router = useRouter()
const toast = useToast() const toast = useToast()
const trackers = inject('trackers') const trackers = inject('trackers')
const rtcConfig = inject('rtcConfig')
var webTorrent = null var webTorrent = null
var wireUpdateHandle = null var wireUpdateHandle = null
const player = ref(null) const player = ref(null)
@ -93,7 +94,7 @@ export default {
}) })
onMounted(() => { onMounted(() => {
webTorrent = new WebTorrent() webTorrent = new WebTorrent({ tracker: { rtcConfig: rtcConfig } })
downloadVideo(props.id) downloadVideo(props.id)
}) })