【问题标题】:how to code so torrent play play video on my web site如何编码以便在我的网站上播放 torrent 播放视频
【发布时间】:2021-01-28 01:30:21
【问题描述】:

我得到这个脚本来在我的网站浏览器页面中播放 torrent 流媒体文件,如果我们拖放 torrent 或磁力链接它会播放媒体流,但不是在 torrent 播放器上拖动磁力文件我想单击 torrent 文件来播放它.我不知道添加什么代码这个代码创建一个种子播放器

     ---

     ... <div id="player" class="webtor" />
     <script>
     window.webtor = window.webtor || [];
     window.webtor.push({
        id: 'player',
        magnet: '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',
        on: function(e) {
            if (e.name == window.webtor.TORRENT_FETCHED) {
                console.log('Torrent fetched!', e.data);
            }
            if (e.name == window.webtor.TORRENT_ERROR) {
                console.log('Torrent error!');
            }
    },
    poster: 'https://via.placeholder.com/150/0000FF/808080?Text=Sintel',
    subtitles: [
            {
                srclang: 'en',
                label: 'test',
    src: 'https://raw.githubusercontent.com/andreyvit/subtitle-tools/master/sample.srt',
            }
        ],
        lang: 'en',
        i18n: {
            en: {
                common: {
                    "prepare to play": "Preparing Video Stream... Please 

        Wait...",
                },
                stat: {
                    "seeding": "Seeding",
                    "waiting": "Client initialization",
                    "waiting for peers": "Waiting for peers",
                    "from": "from",
                   },
                  },
             },
          });
        </script>
        <script src="https://cdn.jsdelivr.net/npm/@webtor/player-sdk-

                     js/dist/index.min.js" charset="utf-8"></script>
    ---

【问题讨论】:

    标签: javascript webtorrent


    【解决方案1】:

    实际上有一个网络洪流客户端,它的实现要容易得多

    链接:https://www.npmjs.com/package/webtorrent

    【讨论】:

      猜你喜欢
      • 2013-02-14
      • 1970-01-01
      • 1970-01-01
      • 2014-10-31
      • 1970-01-01
      • 2012-08-05
      • 2014-08-13
      • 1970-01-01
      相关资源
      最近更新 更多