Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript WebTorrent.IO无法与其他磁铁链接一起使用?_Javascript_Streaming_P2p_Magnet Uri_Webtorrent - Fatal编程技术网

Javascript WebTorrent.IO无法与其他磁铁链接一起使用?

Javascript WebTorrent.IO无法与其他磁铁链接一起使用?,javascript,streaming,p2p,magnet-uri,webtorrent,Javascript,Streaming,P2p,Magnet Uri,Webtorrent,我试着找出答案,但是找不到。我将从这里开始执行以下步骤-。我在文件中有以下代码 <html> <head> <title> StreamTest </title> <script type="text/javascript" src="webtorrent.min.js"></script> <script> var client = new WebTorrent() var torrentId = 'mag

我试着找出答案,但是找不到。我将从这里开始执行以下步骤-。我在文件中有以下代码

<html>
<head>
<title>
StreamTest
</title>
<script type="text/javascript" src="webtorrent.min.js"></script>

<script>
var client = new WebTorrent()

var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d'

client.add(torrentId, function (torrent) {
  // Torrents can contain many files. Let's use the first.
  var file = torrent.files[0]

  // Display the file by adding it to the DOM. Supports video, audio, image,     etc. files
  file.appendTo('body')
})
</script>
</head>
<body>
<h2>Torrent Stream Test</h2>
</body>
</html>

流量测试
var client=new WebTorrent()
var torrentId='磁铁:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d'
添加(torrentId,函数(torrent){
//Torrents可以包含许多文件。让我们使用第一个。
var file=torrent.files[0]
//通过将文件添加到DOM来显示该文件。支持视频、音频、图像等文件
appendTo('body')文件
})
急流试验
此代码与infohash-6a9759bffd5c0af65319979fb7832189f4f3c35d配合使用效果良好 但当我使用其他信息散列或磁铁链接时,它不起作用。 其他信息散列的示例为80096C11147EEE4D2B6B6AC0B96C951E48298BE3


任何想法,为什么它不能与其他infohash或Magnetic链接一起工作?

浏览器中的WebTorrent将仅与WebRTC种子种子种子或具有有效WebTorrent webseed的种子一起工作。不幸的是,TCP/UDP连接无法在JS中本机完成,因此除非使用浏览器扩展,否则无法连接到正常的TCP/UDP对等点。(我是WebTorrent项目的合作者)@DiegoRBaquero我可以这样做:托管一个使用WebTorrent作为种子服务器的nodejs服务器,然后连接到该nodejs创建的服务器。@holmescn是的,使用WebTorrent hybrid,尽管我建议使用Webeeds。@DiegoRBaquero您能稍微扩展一下Webeeds的使用吗?比如说,我拿一个网页的磁铁链接来说,这是否意味着先下载它,然后使用webrtc客户端植入它?@Stanislasdrg要创建一个Webeed,是的,你需要先有内容,然后创建Webeed,然后上传到公共的地方。