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:
authorFeross Aboukhadijeh <feross@feross.org>2015-01-27 05:04:18 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-01-27 05:04:18 +0300
commitbb07d4db0e213611899d834b022e00936172557e (patch)
tree898c2ab31961ddfa2bc0c950e5bd44b4e1522529 /examples/browser-stream-to-audio.js
parenta3fdd9aafeb70f1fea545879131523b2906c3979 (diff)
JavaScript Standard Style
Diffstat (limited to 'examples/browser-stream-to-audio.js')
-rw-r--r--examples/browser-stream-to-audio.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/examples/browser-stream-to-audio.js b/examples/browser-stream-to-audio.js
index 84dfdfd..01c6499 100644
--- a/examples/browser-stream-to-audio.js
+++ b/examples/browser-stream-to-audio.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 an mp3 audio file
- var file = torrent.files[0]
-
- // Create an audio element
- var audio = document.createElement('audio')
- audio.controls = true
- document.body.appendChild(audio)
-
- // Stream the audio into the audio tag
- file.createReadStream().pipe(audio)
-})
+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 an mp3 audio file
+ var file = torrent.files[0]
+
+ // Create an audio element
+ var audio = document.createElement('audio')
+ audio.controls = true
+ document.body.appendChild(audio)
+
+ // Stream the audio into the audio tag
+ file.createReadStream().pipe(audio)
+})