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 i send a stream other then video & voice? #81

Closed
jimmywarting opened this issue Jun 22, 2016 · 5 comments
Closed

Can i send a stream other then video & voice? #81

jimmywarting opened this issue Jun 22, 2016 · 5 comments

Comments

@jimmywarting
Copy link

jimmywarting commented Jun 22, 2016

Chrome v52 brings ReadableStream constructor to the table. It would be cool if it would be possible to send a blob/file as a readableStream. I have written a blob stream reader recently. And now i want to send it over webrtc. (from browser to the server - using electron-webrtc)

There is also this alternative blob reader but it uses node's stream

var blobStream = new ReadableStream({...}); // read blob as chunks
var peer2 = new SimplePeer({ stream: blobStream })
@yocontra
Copy link
Collaborator

Have you tried sending the chunks over an RTC data stream?

@jimmywarting jimmywarting changed the title Send a stream other then video & voice? Can i send a stream other then video & voice? Jun 22, 2016
@jimmywarting
Copy link
Author

jimmywarting commented Jun 22, 2016

@contra no, i haven't tried that yet, not sure how i would handle back pressure & queuing and also larger files

I want to have the RTC data stream more as a communication layer and be able to send a blob in a separate stream that can handle backpressure and is also sent it in order.
I think the blobStream should also close when the file has sent everything.

@yocontra
Copy link
Collaborator

@jimmywarting simple-peer exposes data channels as a duplex stream so it should handle your case (back pressure). You can open as many data channels as you want, one for files and one for communication.

@yocontra
Copy link
Collaborator

On second look the API for creating multiple data channels seems a little tricky to use.

@feross How do you feel about making multiple data channels part of the API?

@feross
Copy link
Owner

feross commented Jul 15, 2016

@jimmywarting The stream option is for media streams, like from a microphone or webcam. What you want is the data channel. As @contra said, simple-peer instances are node.js style duplex streams, so you should not pass a stream option.

@contra I'm open to supporting multiple data channels as part of the API if we can do it in a backwards-compatible way. There was discussion about this before in #19.

@feross feross closed this as completed Jul 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants