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

Is it possible to stream audio/video over data channels? #156

Closed
modeswitch opened this issue Jan 7, 2015 · 12 comments
Closed

Is it possible to stream audio/video over data channels? #156

modeswitch opened this issue Jan 7, 2015 · 12 comments

Comments

@modeswitch
Copy link

https://github.com/muaz-khan/WebRTC-Experiment/tree/master/RecordRTC
https://github.com/streamproc/MediaStreamRecorder

Seems like it might be possible.

@markandrus
Copy link
Member

@modeswitch Yes, see the MediaSource API and this example. Splitting a pre-recording file into chunks and sending them down over the data channel should be doable. Reconstructing them in a <video> element in the browser would look roughly like

var mediaSource = new MediaSource();
var sourceBuffer = mediaSource.addSourceBuffer('video/webm; codecs="vorbis,vp8"');

// Then, for each chunk of your file...
sourceBuffer.appendBuffer(new Uint8Array(data));

@modeswitch
Copy link
Author

Very cool. This looks like an acceptable workaround for media streams using the current native codebase.

@amki
Copy link

amki commented Sep 29, 2015

Do you also have a workaround for receiving and sending MediaStreams generated with getUserMedia?

@zhirzh
Copy link

zhirzh commented Nov 3, 2015

webrtc also features media streams, which are meant for live stream (i.e., with getUserMedia).
Read more here and here

@amki
Copy link

amki commented Nov 3, 2015

I know but this library doesn't support them so I can't handle them server-side.

@mitar
Copy link

mitar commented Dec 9, 2015

+1 for the media streams support. Maybe that could be a compilation time switch?

@tjacobs
Copy link

tjacobs commented Dec 15, 2015

+1 what library has mediastreams?

@aep
Copy link

aep commented Dec 29, 2015

Not actually handling media stuff in the node module makes alot of sense, but wouldn't it be sufficient to just have it expose it as callbacks so that can be used to implement the actual media stream?

@mitar
Copy link

mitar commented Mar 7, 2016

I am not really getting relation between this package and simple-peer, but it seems simple-peer support media streams?

@zycbobby
Copy link

@mitar I dont think so, simple-peer just take advantage of this project. And media stream API is only available on the browser

@t-mullen
Copy link

t-mullen commented Apr 6, 2017

You can provide MediaStream to media-recorder-stream, pipe the recording into the datachannel, then reassemble a MediaSource with media-source-stream.

Note that you will need to receive the entire recorder stream from start or the MediaSource won't be able to reassemble the video. (You can't start midway like a normal MediaConnection). But that shouldn't be a problem if you're careful with when you start recording.

DEMO!

@chuuuing
Copy link

chuuuing commented Dec 12, 2022

for audio/video streaming you could use

navigator.mediaDevices.getUserMedia({audio: true, video: true}).then((stream)=>{
const track = stream.getTracks()[0];
myWebRTC.addTrack(track, stream);
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants