webtorrent: Magnet link with web seed does not work
Hi, i’m trying to make streaming to a HTML5 video tag. Here is my full code:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Web Torrent Player</title>
<script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
</head>
<body style="background-color: black">
<script>
var showPlayer = function (){
console.log('Creating WebTorrent Client..');
var client = new WebTorrent();
var magnetUri = 'magnet:?xt=urn:btih:4cb67059ed6bd08362da625b3ae77f6f4a075705&dn=bl001-introduction.webm&tr=http%3A%2F%2Ft.bitlove.org%2Fannounce&ws=http%3A%2F%2Fspaceboyz.net%2F%7Eastro%2Fbitlove-show%2Fbl001-introduction.webm';
if(!client){
console.log('ERROR creating WebTorrent Client!');
return;
}
console.log('Adding torrent url..');
client.add(magnetUri, function (torrent) {
// Got torrent metadata!
console.log('Torrent info hash:', torrent.infoHash);
// Let's say the first file is a webm (vp8) or mp4 (h264) video...
var file = torrent.files[0];
// Create a video element
var video = document.createElement('video');
video.controls = true;
document.body.appendChild(video);
// Stream the video into the video tag
file.createReadStream().pipe(video);
});
}
// loads the player
showPlayer();
</script>
</body>
</html>
I’m getting different errors on the client.add(…) call, on firefox and chrome:
On firefox 38.0 on Ubuntu, i get this on the console:
“TypeError: a.parsedTorrent.pieces is undefined webtorrent.min.js:2:930”
On chrome 43.0.2357.125 on Ubuntu, i get this other error on the console:
“webtorrent.min.js:2 Uncaught TypeError: Cannot read property ‘length’ of undefined”
As the client.add(…) call fails, the video tag can’t even load.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 23 (10 by maintainers)
Commits related to this issue
- Add failing test for #376 (Magnet link with web seed fails) — committed to webtorrent/webtorrent by feross 11 years ago
- Fix magnet links with web seed (fix #376) — committed to webtorrent/webtorrent by feross 11 years ago
Hi, when .torrent file is created in the browser runtime, where are the .torrents stored? On instant.io?