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

Opening magnet URLs on web doesn't work #1787

Closed
jimfilippou opened this issue Dec 9, 2019 · 4 comments
Closed

Opening magnet URLs on web doesn't work #1787

jimfilippou opened this issue Dec 9, 2019 · 4 comments

Comments

@jimfilippou
Copy link

@jimfilippou jimfilippou commented Dec 9, 2019

What version of this package are you using?
0.107.17

What operating system, Node.js, and npm version?
MacOS Catalina, node v12.11.1

What happened?
Magnet URLs do not open from The Pirate Bay and torrent files do not stream.

What did you expect to happen?
I expect the magnet URL from anywhere to work.

Are you willing to submit a pull request to fix this bug?
I am, if I knew what is going on.

Using this code

previewTorrent(): void {
	if (!(this.file || this.magnet)) {
		this._snackBar.open('Please open a torrent file or paste a magnet link', 'OK', {
			duration: 4000,
		});
		return;
	}
	const identifier: File | string = this.file ? this.file : this.magnet;
	this._client.add(identifier as any, (torrent: WebTorrent.Torrent) => {
		this.files = torrent.files;
		torrent.destroy();
	});
}

when I use the magnet provided by the website, it works and the files can be previewed. When using a magnet link from any other source, it simply does nothing. Now, when opening .torrent files, behaves differently, it first previews the files and when I click on stream button which all it does is

this._client.add(identifier as any, (torrent: WebTorrent.Torrent) => {

	console.log(`Active torrent is set to ${torrent.name}`);
	this.activeTorrent = torrent;

	const file: WebTorrent.TorrentFile = torrent.files.find(function (file) {
		return file.name == selectedFile;
	});

	console.log(`Appending video file to native element...`);
	file.appendTo(this._video.nativeElement)

})

it shows a warning which says videostream.js:8 don't invoked VideoStream without 'new'. This issue is directly associated to jhiesey/videostream#49 however, I don't know why it does this. This bug is reproduced also in Windows 10

@n2nco

This comment has been minimized.

Copy link

@n2nco n2nco commented Jan 12, 2020

Note:
"In Node, WebTorrent connects to TCP/UDP peers.
On the browser it can't, it can only connect to WebRTC peers."

You can test this^

  1. paste the magnet link into your webtorrent desktop,
  2. copying the magnet link from the downloading or seeding item.
  3. use this newly copied magnet link in your browser app.
    (your browser client is now connecting to a WebRTC-capable peer)
@jimfilippou

This comment has been minimized.

Copy link
Author

@jimfilippou jimfilippou commented Jan 13, 2020

Note:
"In Node, WebTorrent connects to TCP/UDP peers.
On the browser it can't, it can only connect to WebRTC peers."

You can test this^

  1. paste the magnet link into your webtorrent desktop,
  2. copying the magnet link from the downloading or seeding item.
  3. use this newly copied magnet link in your browser app.
    (your browser client is now connecting to a WebRTC-capable peer)

100% understood! however this is not mentioned anywhere (at least somewhere visible)

@dheeraj-rn

This comment has been minimized.

Copy link

@dheeraj-rn dheeraj-rn commented Jan 13, 2020

@jimfilippou

In the browser, WebTorrent uses WebRTC (data channels) for peer-to-peer transport. It can be used without browser plugins, extensions, or installations. It's Just JavaScript™. Note: WebTorrent does not support UDP/TCP peers in browser.

This is mentioned in README.md

@jimfilippou

This comment has been minimized.

Copy link
Author

@jimfilippou jimfilippou commented Jan 13, 2020

Oh my bad! however this is not further explained or mentioned in bold text. I will close the issue because it should not be open, however the readme should be updated, I will open a PR related to this

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.