Giter VIP home page Giter VIP logo

Comments (2)

muaz-khan avatar muaz-khan commented on June 7, 2024

It isn't yet possible to switch between resolutions without renegotiating peers. However Firefox team shown interest to bring this feature soon.

Chrome requires a separate MediaStream instance to be captured with NEW configurations, and then both peers need to be "renegotiated" to make sure new RTP ports are applied.

RTCMultiConnection is having following methods that auto-performs renegotiation:

  1. addStream
  2. removeStream
  3. switchStream
  4. renegotiate
  5. drop
  6. hold
  7. etc.
var videoConstraints = {
    mandatory: {
        maxWidth: 1920,
        maxHeight: 1080
    },
    optional: []
};

connection.mediaConstraints = {
    video: videoConstraints,
    audio: true
};

// It'll capture a NEW stream with modified resolutions
// it'll also quickly renegotiate peers among all connected users
connection.addStream({
    video: true,
    audio: true
});

You can even remove/stop existing stream:

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

// or
connection.removeStream({ local: true });

// or
connection.streams.stop('local');

// or
connection.removeStream('stream-id');
connection.addStream({ audio: true, video: true });

attachExternalStream is useful only when doing initial handshake.

connection.refresh isn't meant to renegotiate peers. It merely sets defaults for local-peer-only. E.g. it can stop all streams, remove all connected peers, close all sockets etc.

from rtcmulticonnection.

Cylix avatar Cylix commented on June 7, 2024

@muaz-khan Thank you for your answer!

from rtcmulticonnection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.