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'
])
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.
app.mount('#app')

View File

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

View File

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