RTCMultiConnection Docs

RTCMultiConnection.streams "object"

HOME © Muaz Khan . @WebRTCWeb . Github . Latest issues . What's New?

RTCMultiConnection.streams object allows you get all local/remote audio/video/screen streams, mute or unmute any stream, and stop or remove any stream.

"streams" object requires RTCMultiConnection <= v2.

Please check "connection.streamEvents" for v3 or new releases.

Mute/UnMute Streams

// mute
connection.streams['stream-id'].mute();

// or unmute
connection.streams['stream-id'].unmute();

Stop Streams

connection.streams['stream-id'].stream.stop();

selectFirst

// select first local stream, any stream
connection.streams.selectFirst({
    local: true
}).mute();

// select first local stream, only those streams that are having video tracks.
connection.streams.selectFirst({
    isVideo: true,
    local: true
}).mute();

selectAll

// select all local streams, all kind of streams
connection.streams.selectAll({
    local: true
}).mute();

// select all local streams, only those streams that are having video tracks.
connection.streams.selectAll({
    isVideo: true,
    local: true
}).mute();

takeSnapshot

connection.streams.selectFirst({
    local: true
}).takeSnapshot(function(snapshotImage, blob) {
    yourImage.src = snapshotImage;
});

connection.streams['stream-id'].takeSnapshot(function(snapshotImage, blob) {
    yourImage.src = snapshotImage;
});

mute

connection.streams.selectFirst({
    local: true
}).mute();

connection.streams['stream-id'].mute();

unmute

connection.streams.selectFirst({
    local: true
}).unmute();

connection.streams['stream-id'].unmute();

stop

connection.streams.selectFirst({
    local: true
}).stop();

connection.streams['stream-id'].stop();

startRecording

connection.streams.selectFirst({
    local: true
}).startRecording();

connection.streams['stream-id'].startRecording();

stopRecording

connection.streams.selectFirst({
    local: true
}).stopRecording(function(blob) {
    // blob.audio
    // blob.video
});

connection.streams['stream-id'].stopRecording(function(blob) {
    // blob.audio
    // blob.video
});

Latest Issues

Want to ask a Question?

You can include your email for private conversation!

Latest Updates