blob: 7be57d0d0144945154dee2d6356378ab1fb07b58 (
plain) (
tree)
|
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/styles.css" />
<title>WebTorrent player - EuAndreh</title>
<script src="/vendor/webtorrent/webtorrent.min.js"></script>
</head>
<body>
<div id="output"></div>
<div id="torrentLink"></div>
<script>
const params = new URLSearchParams(window.location.search);
const torrentID = params.get("torrent"); // "https://webtorrent.io/torrents/sintel.torrent";
document.querySelector("#torrentLink").innerHTML = `Downloading <a href=${torrentID}>${torrentID}</a>`;
const client = new WebTorrent();
client.add(torrentID, torrent =>
torrent.files.forEach(file => file.appendTo("#output")));
</script>
</body>
</html>
|