Permalink
82207b9 Jul 16, 2016
executable file 83 lines (60 sloc) 2.69 KB

Upgrade

This page explains how to upgrade to latest version (v3).

Use streamEvents instead of connection.streams:

var stream = connection.streamEvents['streamid'];

// or use this code:
// backward compatibility
connection.streams = connection.streamEvents;
connection.numberOfConnectedUsers = 0;

if (Object.observe) {
    Object.observe(connection.streamEvents, function() {
        // for backward compatibility
        connection.streams = connection.streamEvents;
    });

    Object.observe(connection.peers, function() {
        // for backward compatibility
        connection.numberOfConnectedUsers = connection.getAllParticipants().length;
    });
}

# you can even use "getStreamById"
var stream = connection.attachStreams.getStreamById('streamid');

# to get remote stream by id
var allRemoteStreams = connection.getRemoteStreams('remote-user-id');
var stream = allRemoteStreams.getStreamByid('streamid');

Wanna check isScreen or isVideo or isAudio?

connection.onstream = function(event) {
    if(event.stream.isScreen) {
        // screen stream
    }

    if(event.stream.isVideo) {
        // audio+video or video-only stream
    }

    if(event.stream.isAudio) {
        // audio-only stream
    }
};

Mute/UnMute?

var stream = connection.streamEvents['streamid'].stream;

stream.mute('audio'); // mute only audio tracks
stream.mute('video'); // mute only video tracks
stream.mute('both'); // mute both video and audio tracks

// or simply
stream.mute(); // mute both video and audio tracks

Other Documents

  1. Getting Started guide for RTCMultiConnection
  2. Installation Guide
  3. How to Use?
  4. API Reference
  5. Upgrade from v2 to v3
  6. How to write iOS/Android applications?
  7. Tips & Tricks

Twitter

License

RTCMultiConnection is released under MIT licence . Copyright (c) Muaz Khan.