Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upIn browser, if no trackers specified, use wss://tracker.webtorrent.io #218
Comments
This comment has been minimized.
This comment has been minimized.
|
In my opinion, a library shouldn't talk to specific services if the user didn't intend to. |
This comment has been minimized.
This comment has been minimized.
|
@astro In general, I agree with your sentiment. In this case, if the user specifies no tracker then WebTorrent simply won't work since no peers will be discovered (the DHT is still unimplemented). This is definitely never what the user wanted. For the time being, we can throw an informative exception: "specify a tracker server to discover peers (you can use wss://tracker.webtorrent.io) (required in browser because DHT is unimplemented)" |
This comment has been minimized.
This comment has been minimized.
|
Just tried webtorrent for the first time - basically copied the example (which uses |
This comment has been minimized.
This comment has been minimized.
|
Hi guys, I'm kind of new in all this js world, so my question is that I had use the example above. here is my code (it was writen in an empty html file) <script src="js/webtorrent.min.js"></script>
<script src="http://wzrd.in/standalone/concat-stream@1.4.7"></script>
<script>
var client = new WebTorrent()
var magnetUri = 'magnet:?xt=urn:btih:b781cc28e64373378bff35f6a4a66d62cd5c6661'
client.add(magnetUri + '&tr=wss://tracker.webtorrent.io', 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)
});
</script>tested on chrome, and the browser doesn't trow any error , but despite that... nothing seems to happen, I'm I missing something out ? |
This comment has been minimized.
This comment has been minimized.
|
@FrancoAguilera It's likely that you're trying to download a torrent with no seeders. See: https://github.com/feross/webtorrent/wiki/FAQ#why-does-browser-downloading-not-work |
This comment has been minimized.
This comment has been minimized.
|
<script src="js/webtorrent.min.js"></script>
<script src="http://wzrd.in/standalone/concat-stream@1.4.7"></script>
<script>
var client = new WebTorrent()
var magnetUri = 'magnet:?xt=urn:btih:d20d2186e129712666ba4c5b40e78877b814418f'
client.add(magnetUri + '&tr=wss://tracker.webtorrent.io', 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)
});
</script>
This doesnt seem to be working. The same .torrent file for the given magnet url i could play it using npm through vlc player. |
This comment has been minimized.
This comment has been minimized.
|
@prashant-andani Yes, you probably are. Read this: https://github.com/feross/webtorrent/wiki/FAQ#why-does-browser-downloading-not-work |
This comment has been minimized.
This comment has been minimized.
|
@feross can we have list of few explicitly seeded torrent files. It would be of great help. |
This comment has been minimized.
This comment has been minimized.
|
Just seed your own file at https://instant.io and test against that. :) |
This comment has been minimized.
This comment has been minimized.
|
I was struggling with the tracker part for a couple of hours. No obvious errors as far as I could tell. In the end it worked by explicitly adding a tracker:
Instead of just
An explicit error would definitely be helpful. |
This comment has been minimized.
This comment has been minimized.
|
@sqren That's weird. Are you running the latest version of webtorrent? There's code to automatically add some reasonable defaults if you don't specify any trackers. |
This comment has been minimized.
This comment has been minimized.
|
Thanks for quick reply! I'm on 0.42 and seeing the problem. I've created a jsbin (with 0.41) to reproduce it: |
This comment has been minimized.
This comment has been minimized.
|
Try 0.43, which fixes the issue. Not sure why that's not on the CDN yet, but you can use https://rawgit.com/feross/webtorrent/master/webtorrent.min.js to get the latest script from the github repo. |
This comment has been minimized.
This comment has been minimized.
|
0.43 did the trick. Awesome! |
This comment has been minimized.
This comment has been minimized.
|
Awesome, glad it works for you now :) |
This comment has been minimized.
This comment has been minimized.
|
@feross i think this should be implemented, as far as user always able to disable it. |
This comment has been minimized.
This comment has been minimized.
|
This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue. |
People think code like this should work:
Currently, you need to do:
To tell the client to use the webtorrent tracker.