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

Open
modeswitch opened this Issue Jan 7, 2015 · 11 comments

Comments

Projects
None yet
9 participants
@markandrus

This comment has been minimized.

Show comment
Hide comment
@markandrus

markandrus Feb 10, 2015

Contributor

@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));
Contributor

markandrus commented Feb 10, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@modeswitch

modeswitch Feb 10, 2015

Member

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

Member

modeswitch commented Feb 10, 2015

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

@amki

This comment has been minimized.

Show comment
Hide comment
@amki

amki Sep 29, 2015

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

amki commented Sep 29, 2015

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

@zhirzh

This comment has been minimized.

Show comment
Hide comment
@zhirzh

zhirzh Nov 3, 2015

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

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

This comment has been minimized.

Show comment
Hide comment
@amki

amki Nov 3, 2015

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

amki commented Nov 3, 2015

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

@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Dec 9, 2015

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

mitar commented Dec 9, 2015

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

@tjacobs

This comment has been minimized.

Show comment
Hide comment
@tjacobs

tjacobs Dec 15, 2015

+1 what library has mediastreams?

tjacobs commented Dec 15, 2015

+1 what library has mediastreams?

@aep

This comment has been minimized.

Show comment
Hide comment
@aep

aep 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?

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

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Mar 7, 2016

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

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

This comment has been minimized.

Show comment
Hide comment
@zycbobby

zycbobby May 16, 2016

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

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

@RationalCoding

This comment has been minimized.

Show comment
Hide comment
@RationalCoding

RationalCoding Apr 6, 2017

Contributor

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!

Contributor

RationalCoding 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!

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