获取webTorrent播放存储在AWS私有s3存储桶中的.mp4文件

问题描述

我正在使用reactjs和flask。获取存储在私有s3存储桶中的.mp4文件的种子文件后,我尝试使用webtorrent在浏览器中显示和播放它。 但是视频内容没有加载

这是对Load and play 1 GB .mp4 in reactjs,stored in private s3 bucket的跟进问题。目前,s3存储桶是公开的。因为私有文件抛出错误

参考代码-https://codepen.io/drngke/pen/abNGbEg

const magnet = 'https://datavocal.s3.amazonaws.com/s3outputx.mp4.torrent'

const client = new WebTorrent()

client.add(magnet,(torrent) => {
  console.log(torrent.files)
  
   torrent.files[0].appendTo('body')

});
client.on("error",(err) => console.log(err))

解决方法

我不确定这是否行得通。

来自webtorrent文档:

为使BitTorrent通过WebRTC(这是唯一可在Web上运行的P2P传输)工作,我们进行了一些协议更改。因此,基于浏览器的WebTorrent客户端或“ Web对等方”只能连接到支持WebTorrent / WebRTC的其他客户端。

进一步:

要将文件播种到Web同行,请使用支持WebTorrent的客户端,例如WebTorrent Desktop,具有熟悉的UI的桌面客户端,可以连接到Web对等,webtorrent-hybrid(一个命令行程序)或Instant.io(一个网站)。

所以我猜想S3必须支持WebTorrent / WebRTC,我认为不会。

enter image description here

如果我对上图的理解是正确的,则可以在S3和Web对等之间运行混合客户端,但是您需要将混合客户端托管在某种程度上使该设置中S3冗余。 / p>