diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2017-03-31 03:09:49 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2017-03-31 03:09:49 +0300 |
commit | cd1a20104718b2cf5184436ba7e846db4f606503 (patch) | |
tree | 39fce894eddb2bb7beff5c551ececb2d717ddacf /docs | |
parent | 8e020d1fbb697912893c423e253ef5b06c46a7f3 (diff) |
update docs with new sintel torrent
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api.md | 8 | ||||
-rw-r--r-- | docs/faq.md | 7 | ||||
-rw-r--r-- | docs/get-started.md | 19 |
3 files changed, 23 insertions, 11 deletions
diff --git a/docs/api.md b/docs/api.md index 453e374..70046e4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -18,11 +18,13 @@ npm install webtorrent ```js var client = new WebTorrent() -var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4' +var torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent' client.add(torrentId, function (torrent) { - // Torrents can contain many files. Let's use the first. - var file = torrent.files[0] + // Torrents can contain many files. Let's use the .mp4 file + var file = torrent.files.find(function (file) { + return file.name.endsWith('.mp4') + }) // Display the file by adding it to the DOM. Supports video, audio, image, etc. files file.appendTo('body') diff --git a/docs/faq.md b/docs/faq.md index 23acc38..0c26b74 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -207,10 +207,13 @@ It's easy to download a torrent and add it to the page. ```js var client = new WebTorrent() -var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4' +var torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent' client.add(torrentId, function (torrent) { - var file = torrent.files[0] + // Torrents can contain many files. Let's use the .mp4 file + var file = torrent.files.find(function (file) { + return file.name.endsWith('.mp4') + }) file.appendTo('body') // append the file to the DOM }) ``` diff --git a/docs/get-started.md b/docs/get-started.md index 1c9e354..58529d6 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -41,11 +41,13 @@ var WebTorrent = require('webtorrent') var client = new WebTorrent() // Sintel, a free, Creative Commons movie -var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4' +var torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent' client.add(torrentId, function (torrent) { - // Torrents can contain many files. Let's use the first. - var file = torrent.files[0] + // Torrents can contain many files. Let's use the .mp4 file + var file = torrent.files.find(function (file) { + return file.name.endsWith('.mp4') + }) // Display the file by adding it to the DOM. // Supports video, audio, image files, and more! @@ -91,7 +93,7 @@ var WebTorrent = require('webtorrent') var client = new WebTorrent() -var magnetURI = 'magnet:...' +var magnetURI = 'magnet: ...' client.add(magnetURI, { path: '/path/to/folder' }, function (torrent) { torrent.on('done', function () { @@ -119,7 +121,7 @@ downloaded. <form> <label for="torrentId">Download from a magnet link: </label> - <input name="torrentId", placeholder="magnet:" value="magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4"> + <input name="torrentId", placeholder="magnet:" value="magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent"> <button type="submit">Download</button> </form> @@ -303,8 +305,13 @@ or [Instant.io](https://instant.io) to seed torrents to the WebTorrent network. // Download the torrent client.add(torrentId, function (torrent) { + // Torrents can contain many files. Let's use the .mp4 file + var file = torrent.files.find(function (file) { + return file.name.endsWith('.mp4') + }) + // Stream the file in the browser - torrent.files[0].appendTo('#output') + file.appendTo('#output') // Trigger statistics refresh torrent.on('done', onDone) |