RTCMultiConnection StreamID

Muaz Khan edited this page Oct 13, 2016 · 1 revision

This page explains how to get (and/or use) streamid object using RTCMultiConnection.

One can get streamid using following methods:

connection.onstream = function(event) {
    var streamid = event.streamid;
    var streamMediaType = event.type;
    var streamTracksType = 'unknown';

    if (event.stream.isAudio) {
        streamTracksType = 'AudioTrack';
    }

    if (event.stream.isVideo) {
        streamTracksType = 'AudioVideoTrack or OnlyVideoTrack';
    }

    if (event.stream.isScreen) {
        streamTracksType = 'ScreenPlusAudioTrack or OnlyScreenTrack';
    }
};

Get all local streams stream-ids:

connection.attachStreams.forEach(function(stream) {
    var localStreamid = stream.streamid;
    var localStreamMediaType = stream.type;
    var localStreamTrackType = stream.isAudio || stream.isVideo || stream.isScreen;
});

Get all streams local and-or remote stream-ids:

Object.keys(connection.streamEvents).forEach(function(streamid) {
    var stream = connection.streamEvents[streamid];
    var localStreamMediaType = stream.type;
    var localStreamTrackType = stream.isAudio || stream.isVideo || stream.isScreen;
});

Get specific user’s remote streams stream-ids:

var user = connection.peers['target-userid'];
user.streams.forEach(function(remoteStreamId) {
    var stream = connection.streamEvents[remoteStreamId];
    var localStreamMediaType = stream.type;
    var localStreamTrackType = stream.isAudio || stream.isVideo || stream.isScreen;
});
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.