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

Error when trying to stream video torrent #836

Closed
uriylla opened this issue Jun 14, 2016 · 2 comments
Closed

Error when trying to stream video torrent #836

uriylla opened this issue Jun 14, 2016 · 2 comments

Comments

@uriylla
Copy link

@uriylla uriylla commented Jun 14, 2016

I'm building a video streamming application with Electron and I'm facing a problem for which I haven't found any solution so far.

My code is the following:

const $ = require('jquery');
const WebTorrent = require('webtorrent');
global.jQuery = $;

$(document).ready(function(){
var client = new WebTorrent();
var magnetUri = 'https://webtorrent.io/torrents/sintel.torrent';
client.add(magnetUri, function (torrent) {
var file = torrent.files[0];
var video = document.createElement('video');
video.controls = true;
$('#main-container').append(video);
file.createReadStream().pipe(video);
});

var timer = setInterval(function(){ console.log(client.torrents[0].timeRemaining); }, 1000);
console.log(client);
console.log(client.torrents[0].infoHash);
console.log(client.torrents[0].files);

})

And after a little bit I get the following error in the console:

Uncaught TypeError: dest.on is not a function
from this file: ..app/node_modules/webtorrent/node_modules/readable-stream/lib/_stream_readable.js

and on my terminal I see those errors as well:

[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185408:ERROR:webrtcsession.cc(1210)] ConnectDataChannel called when data_channel_ is NULL.
[9504:0614/185425:ERROR:sctpdataengine.cc(944)] SctpDataMediaChannelFailed to send a stream reset for 1 streams: [0x00000009] Bad file descriptor
[9504:0614/185435:ERROR:sctpdataengine.cc(944)] SctpDataMediaChannelFailed to send a stream reset for 1 streams: [0x00000002] No such file or directory

Any help would be much appreciated.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jun 16, 2016

This way of streaming into a video tag is no longer supported:

file.createReadStream().pipe(video);

Instead you should do:

file.renderTo(video);
@feross feross closed this Jun 16, 2016
@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 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
2 participants
You can’t perform that action at this time.