freedom/layouts/shortcodes/webtorrent-video.html

17 lines
626 B
HTML
Raw Normal View History

2022-08-17 14:50:07 -04:00
<script src="/webtorrent.js"></script>
<div id="wtmedia">
</div>
<script>
const client = new WebTorrent(tracker=false,dht=true,webSeeds=true);
const magnetURI = '{{.Get 0}}';
client.add(magnetURI, function (torrent) {
// Got torrent metadata!
console.log('Client is downloading:', torrent.infoHash)
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).
file.appendTo('#wtmedia')
})
})
</script>