Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'examples/browser-stream-to-video.js')
-rw-r--r--examples/browser-stream-to-video.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/examples/browser-stream-to-video.js b/examples/browser-stream-to-video.js
index 7943a64..e721cee 100644
--- a/examples/browser-stream-to-video.js
+++ b/examples/browser-stream-to-video.js
@@ -1,19 +1,20 @@
-var WebTorrent = require('webtorrent')
-
-var client = new WebTorrent()
-
-client.add(magnet_uri, 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)
-})
+var WebTorrent = require('webtorrent')
+
+var client = new WebTorrent()
+var magnetUri = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36'
+
+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)
+})