Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
Variable pointing to null again instead of pointing to object

In the below given code I have created rtcobj variable at global scope using var datatype(initially null assigned),but when I am assigning the object RTCPeerConnection(configuration) the variable points to RTCPeerConnection(configuration) as long as the function lasts, but afterwards rtcobj starts pointing to null again. Why is it happening so I am not getting (Means why rtcobj points to null again instead of rtc object).

navigator.webkitGetUserMedia({video:true,audio:true},function(mystream){
                        localvideo.srcObject=mystream;
                        conn.mystream=mystream
                        var configuration = { 
                            "iceServers": [{ "url": "stun:stun2.1.google.com:19302" }]
                        };
                        rtcobj=new RTCPeerConnection(configuration)
                        console.log(rtcobj)
                        rtcobj.addStream(mystream);
                        rtcobj.onaddstream=function(event){
                            otherpeerspan.style.display="none"
                            muteunmute.style.display="block"
                            remotevideo.srcObject=event.stream
                        } 
                        
                        rtcobj.onicecandidate=function(event){
                            if(event.candidate){
                                send({ 
                                    type: "candidate", 
                                    candidate: event.candidate 
                                }); 
                            }
                        }
                    },function (error) { 
                        console.log(error); 
                        }
                    )
                                                                                                                            
                }
                console.log("rtc:"+rtcobj)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!