1

I am trying to make a video call using Twilio API with lightning component. In afterScript was successfully loaded. When we are try to access getUserMedia in afterScript load we are getting Cannot read property 'getUserMedia' of undefined error. we have checked script code in locker console, it's getting error on locker service issue. So we are planned to overcome this issue using lightning out concept. But unfortunately we are getting error DOM Exception:Permission Denied in lightning out.

Here, we attach the sample code of what we are implementing.

TwilioApp :

<aura:Application extends="force:slds">
    <iframe width="100%" height="450px" src="{!'/apex/VideoVf'}"/>
</aura:Application>

VideoVf :

<apex:page showHeader="false" sidebar="false">
    
    <apex:includeScript value="{!$Resource.TwilioVideoJs}"/>
    
    <body>
        <div class="viewtable" id="videogrid">
             <div class="viewcontrol">
                  <div class="participantList" id="participant">
                  </div>
                  <div class="Primaryview" id="primaryid">     
                  </div>
              </div>
          <div class="yourView" id="urId">

          </div>    
        </div> 
    </body>
    
    <script>
        creatRoom();
    
       function creatRoom() {
            navigator.mediaDevices.getUserMedia({
                audio: true,
                video: true
            }).then(function(mediaStream) {
                console.log("mediaStream created:::");
            }).catch(error => {
                console.log('Could not connect to the Room:', error.message);
            });
            
        }
        
   </script>
</apex:page>

Note : Directly working fine on Vf page.

If any one give solution, we will really appreciate

1
  • Hi, Did you manage to resolve it ? I am having the same issue ? Commented Nov 16, 2022 at 12:31

1 Answer 1

1

This is not a Lighting Component Issue. Most WebRTC Apis are not supported in Lockerservice. The only "workaround" change the of lightning component version to v.39.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .