-1

我得到这个脚本来在我的网站浏览器页面中播放 torrent 流媒体文件,如果我们拖放 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>
    ---
4

1 回答 1

0

实际上有一个 web torrent 客户端,它的实现要容易得多

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

于 2021-01-28T01:41:33.790 回答