Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run video streaming example with standalone webtorrent.min.js #275

Closed
ghost opened this issue Feb 28, 2015 · 2 comments
Closed

Can't run video streaming example with standalone webtorrent.min.js #275

ghost opened this issue Feb 28, 2015 · 2 comments

Comments

@ghost
Copy link

@ghost ghost commented Feb 28, 2015

Trying to run example from main page

        <script src="webtorrent.min.js"></script>
        <script>
            var client = new WebTorrent();
            var magnetUri = 'magnet:?......';

            client.add(magnetUri, function (torrent) {
                var file = torrent.files[0];
                var video = document.createElement('video');
                video.controls = true;
                document.body.appendChild(video);
                file.createReadStream().pipe(video);
            });

            console.log(client);
            console.log(client.torrents[0].infoHash);
            console.log(client.torrents[0].files);
      </script>

Tried different magnet uri's but console.log(client.torrents[0].files); always returns empty array.

files []

I can get info hash from console.log and it shows all data, but files array is always empty and because of that video element isn't created

But i can open magnet uri and stream to vlc player from console using webtorrent download "magnet:?......" --vlc

Why browser code with webtorrent.min.js does not see any files in torrent files to stream ?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Mar 4, 2015

You can't just paste in any random magnet uri or .torrent file!

In the browser, WebTorrent can only download torrents that are explicitly seeded to the WebTorrent network. Desktop torrent clients need to support WebRTC to peer with web browsers. Currently, no clients support it but you can use http://instant.io/ to seed torrents to the WebTorrent network.

@feross feross closed this Mar 4, 2015
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Mar 4, 2015

This question has been asked about a dozen times already, so I'm starting an FAQ: https://github.com/feross/webtorrent/wiki/FAQ

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.