Compare commits
No commits in common. "8561b9c6c613305c0cbbe1f6faf3228ed2d92318" and "201ee9813f7311972071fba9e24c1b2c0cf7ee90" have entirely different histories.
8561b9c6c6
...
201ee9813f
|
@ -59,7 +59,6 @@ export default {
|
|||
const toast = useToast()
|
||||
const trackers = inject('trackers')
|
||||
var webTorrent = null
|
||||
var wireUpdateHandle = null
|
||||
const player = ref(null)
|
||||
const video = reactive({
|
||||
file: null,
|
||||
|
@ -86,9 +85,6 @@ export default {
|
|||
if (webTorrent) {
|
||||
webTorrent.destroy()
|
||||
}
|
||||
if (wireUpdateHandle) {
|
||||
clearInterval(wireUpdateHandle)
|
||||
}
|
||||
})
|
||||
|
||||
const onFilesSelected = (f) => {
|
||||
|
@ -121,16 +117,14 @@ export default {
|
|||
|
||||
torrent.on('upload', bytes => {
|
||||
state.uploaded += bytes
|
||||
updateWireStatistics()
|
||||
})
|
||||
|
||||
torrent.on('wire', wire => {
|
||||
updateWireStatistics()
|
||||
toast.add({ severity: 'info', summary: 'New watcher', detail: 'Someone has joined your screen.', life: 3000 })
|
||||
})
|
||||
|
||||
wireUpdateHandle = setInterval(() => {
|
||||
updateWireStatistics()
|
||||
}, 200)
|
||||
|
||||
toast.add({ severity: 'success', summary: 'Video added', detail: `You are now sharing ${video.name}`, life: 5000 })
|
||||
})
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ export default {
|
|||
const toast = useToast()
|
||||
const trackers = inject('trackers')
|
||||
var webTorrent = null
|
||||
var wireUpdateHandle = null
|
||||
const player = ref(null)
|
||||
const progress = ref()
|
||||
const video = reactive({
|
||||
|
@ -101,14 +100,12 @@ export default {
|
|||
if (webTorrent) {
|
||||
webTorrent.destroy()
|
||||
}
|
||||
if (wireUpdateHandle) {
|
||||
clearInterval(wireUpdateHandle)
|
||||
}
|
||||
})
|
||||
|
||||
const downloadVideo = (infoHash) => {
|
||||
webTorrent.add(infoHash, { announce: trackers }, torrent => {
|
||||
torrent.on('wire', () => {
|
||||
updateWireStatistics()
|
||||
toast.add({ severity: 'info', summary: 'New watcher', detail: 'Someone has joined your screen.', life: 3000 })
|
||||
})
|
||||
|
||||
|
@ -117,6 +114,7 @@ export default {
|
|||
})
|
||||
|
||||
torrent.on('upload', bytes => {
|
||||
updateWireStatistics()
|
||||
})
|
||||
|
||||
torrent.on('download', bytes => {
|
||||
|
@ -126,6 +124,7 @@ export default {
|
|||
}
|
||||
state.downloaded += bytes
|
||||
progress.value = state.downloaded / video.size * 100
|
||||
updateWireStatistics()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -149,10 +148,6 @@ export default {
|
|||
})
|
||||
|
||||
file.renderTo(player.value)
|
||||
|
||||
wireUpdateHandle = setInterval(() => {
|
||||
updateWireStatistics()
|
||||
}, 200)
|
||||
}
|
||||
|
||||
const updateWireStatistics = () => {
|
||||
|
|
Loading…
Reference in New Issue