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

How do i know if a torrent is uploaded via WebRTC supported client #1654

Closed
msqaddura opened this issue Jun 27, 2019 · 5 comments
Closed

How do i know if a torrent is uploaded via WebRTC supported client #1654

msqaddura opened this issue Jun 27, 2019 · 5 comments
Labels

Comments

@msqaddura
Copy link

@msqaddura msqaddura commented Jun 27, 2019

My apologies but i have been trying to find an answer, and thought maybe i can best get it here so this is rather a question than an issuee.

I understand that for a torrent to work in the browser with webtorrent it needs to be uploaded by a client that supports WebRTC (vuze, webtorrent-desktop.....and this list go on).

My question is, can I know if the torrent supports WebRTC? or maybe the client that uploaded it? I dont want to play guessing game on wether the video will play in browser or not. is that possible by magnet link, file url, or any other means?

Thank you in advance

@jimmywarting

This comment has been minimized.

Copy link
Contributor

@jimmywarting jimmywarting commented Jun 27, 2019

I understand that for a torrent to work in the browser with webtorrent it needs to be uploaded by a client that supports WebRTC (vuze, webtorrent-desktop.....and this list go on).

Not exactly. A person that uses webtorrent-desktop can download a "regular" torrent and add own websocket trackers to make the torrent discoverable by webtorrent in the browser.

My question is, can I know if the torrent supports WebRTC? or maybe the client that uploaded it? I don't want to play guessing game on wether the video will play in browser or not. is that possible by magnet link, file url, or any other means?

You don't know exactly what's inside the torrent by just looking in the magnet link
a web torrent client can upload non playable video items as well.

if the magnet link has wss={TRACKER} or ws={TRACKER} then it means that a torrent file is discoverable by a WebRTC supported torrent client and could maybe have been created with a WebRTC torrent client. magnet links can be edited or changed by torrent sites that hosts torrent or magnet links.

I would say that guessing based on just magnet link is a bad idea. cuz you can never really know if it was created by a WebRTC client

@jimmywarting

This comment has been minimized.

Copy link
Contributor

@jimmywarting jimmywarting commented Jun 27, 2019

Only way to know is to download the metadata (fileList) and check wether or not the extension is supported

  1. download filelist
  2. look up the mimetype with https://www.npmjs.com/package/mime
  3. check if video is supported with HTMLMediaElement.canPlayType()
@jimmywarting

This comment has been minimized.

Copy link
Contributor

@jimmywarting jimmywarting commented Jun 27, 2019

Also WebTorrent in the browser only supports streaming mp4 fragments. if you need a wider range of supported container have a look at

@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Jul 20, 2019

Hi @msqaddura

To add onto @jimmywarting's answer, if the torrent does have a &ws= tracker, you can use the torrent-discovery library or the bittorrent-tracker library to communicate with these trackers to determine the number of peers.

Alternatively you can perform a shotgun approach and query the main ws/wss trackers with any infoHash, using the libraries mentioned above, to determine if there are any peers on these trackers for the given infoHash.

As there's adequate information here and this is more of a question, I'm going to close this issue but please feel to continue the conversation in here if you need any more help or guidance.

Kind regards
Brad

@msqaddura

This comment has been minimized.

Copy link
Author

@msqaddura msqaddura commented Aug 6, 2019

Thank you all guys <3 I will take it from here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.