You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1022 B
HTML

2 years ago
<style>
#wtmedia{
width:100%;
}
#wtmedia video{
width:100%;
}
</style>
2 years ago
<script src="/webtorrent.js"></script>
2 years ago
<div class="webtorrent">
<noscript>
<video controls>
<source src={{.Get "source"}}>
</video>
</noscript>
<div id="wtmedia">
</div>
<div>
Peers:<span id="Peers"></span>
</div>
2 years ago
</div>
<script>
2 years ago
const client = new WebTorrent();
const magnetURI = {{.Get "magnet"}};
2 years ago
client.add(magnetURI, function (torrent) {
// Got torrent metadata!
2 years ago
torrent.addWebSeed({{.Get "source"}});
console.log('Client is downloading:', torrent.infoHash);
2 years ago
torrent.files.forEach(function (file) {
// Display the file by appending it to the DOM. Supports video, audio, images, and
// more. Specify a container element (CSS selector or reference to DOM node).
2 years ago
file.appendTo('#wtmedia');
2 years ago
})
2 years ago
});
function updateData(torrent);
window.setInterval()
</script>