Giter VIP home page Giter VIP logo

Comments (8)

Karthikdb avatar Karthikdb commented on June 14, 2024
changedevice(videoinput,audioinput) {
  this.setState({
  videoinput:videoinput,
  audioinput:audioinput
  });
  alert(this.state.videoinput);

  console.log(this.state.videoinput,this.state.audioinput);
      const op = {
        video: {
          width: { min: 160, ideal: 640, max: 1280 },
          height: { min: 170, ideal: 360, max: 720 },
          facingMode:this.state.videoinput
          
        },
        audio:{echoCancellation: true,
          deviceId: this.state.audioinput} 
      };
      navigator.getUserMedia(
        op,
        stream => {
      
          stream.oninactive = () => {
            Object.keys(this.state.peers).forEach((key)=>{
              this.state.peers[key].removeStream(this.state.localStream);
            })
            this.getUserMedia().then(() => {
              Object.keys(this.state.peers).forEach((key)=>{
                this.state.peers[key].addStream(this.state.localStream);
              })
            });
          };
          this.setState({ streamUrl: stream, localStream: stream });
          this.localVideo.srcObject = stream;
          Object.keys(this.state.peers).forEach((key)=>{
            this.state.peers[key].addStream(this.state.localStream);
          })
        
        },
        () => { }
      );

    
    }

This is what I am trying but the video is getting an update. What is wrong with this code?? @diegogurgel @kevinjpuscan

from react-webrtc.

Karthikdb avatar Karthikdb commented on June 14, 2024

Could you please help me with this?? @diegogurgel @kevinjpuscan

from react-webrtc.

diegogurgel avatar diegogurgel commented on June 14, 2024

Are you saying that you have multiple devices connected to the computer and want to select them? Did I get it right?

from react-webrtc.

Karthikdb avatar Karthikdb commented on June 14, 2024

Yeah I am trying on smart phone also I can't switch between front and rear camera

from react-webrtc.

Karthikdb avatar Karthikdb commented on June 14, 2024

Do u have any solution?? @diegogurgel

from react-webrtc.

diegogurgel avatar diegogurgel commented on June 14, 2024

Maybe this piece of code can help you with selecting different sources https://github.com/samdutton/simpl/blob/gh-pages/getusermedia/sources/js/main.js

This is basically listing all devices available setting one as a source when you select.

from react-webrtc.

Karthikdb avatar Karthikdb commented on June 14, 2024

I can get the stream by device Id but i cannot set that to localstream and also not able to peer

from react-webrtc.

Karthikdb avatar Karthikdb commented on June 14, 2024

I can get the stream by device Id but i cannot set that to localstream and also not able to peer

Solved !!

from react-webrtc.

Related Issues (14)

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.