question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property 'peerConnection' does not exist on type 'SessionDescriptionHandler'

See original GitHub issue

Hello, I got the following problem when trying to migrate from sipjs 0.15.11 to sjipjs 0.16.1. Am I missing something here?

Describe the bug Property ‘peerConnection’ does not exist on type ‘SessionDescriptionHandler’

Logs

error TS2339: Property 'peerConnection' does not exist on type 'SessionDescriptionHandler'.

To Reproduce Steps to reproduce the behavior:

  1. Create a user agent and handle incoming call
  2. Try to attach a media as mentioned here attach-media Using this code
// Assumes you have a media element on the DOM
const mediaElement = document.getElementById('mediaElement');

const remoteStream = new MediaStream();
function setupRemoteMedia(session: Session) {
  session.sessionDescriptionHandler.peerConnection.getReceivers().forEach((receiver) => {
    if (receiver.track) {
      remoteStream.addTrack(receiver.track);
    }
  });
  mediaElement.srcObject = remoteStream;
  mediaElement.play();
}

Expected behavior Property ‘peerConnection’ should exist on type ‘SessionDescriptionHandler’

Observed behavior Compilation throws the error : Property ‘peerConnection’ does not exist on type ‘SessionDescriptionHandler’

Environment Information

  • SipJS 0.16.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

3reactions
SD-Gamingcommented, May 29, 2020

I meet the same issue, and I import the SessionDescriptionHandler from ‘sip.js/lib/platform/web’ to fix it, it works well so far.

0reactions
floriandeubelcommented, Jul 1, 2020

If someone should also have this problem. That’s how it worked for me:

import '{ SessionDescriptionHandler } from 'sip.js/lib/platform/web'

case SessionState.Established:
        let sessionDescriptionHandler: SessionDescriptionHandler = inviter.sessionDescriptionHandler as SessionDescriptionHandler;
        setupRemoteMedia(sessionDescriptionHandler);
        break;

function setupRemoteMedia(session: SessionDescriptionHandler) {
  let receiversList: any = session.peerConnection.getReceivers();
  receiversList.forEach((receiver: RTCRtpReceiver) => {
    if (receiver.track) {
      remoteStream.addTrack(receiver.track);
    }
  });
  mediaElement.srcObject = remoteStream;
  mediaElement.play();
}

Improvements and remarks are gladly accepted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

missing events + peerConnection typings · Issue #681 · onsip ...
Property 'on' does not exist on type 'SessionDescriptionHandler'. Property 'peerConnection' does not exist on type 'SessionDescriptionHandler'.
Read more >
Session Description Handler - SIP.js
The WebRTC Session Description Handler is the default handler for SIP.js.
Read more >
RTCPeerConnection deprecated properties not available in ...
In sl_rtc the code is using deprecated properties, ... error TS2339: Property >'onaddstream' does not exist on type 'RTCPeerConnection'.
Read more >
How do I get the onaddstream event of peerconnection on 0.8 ...
peerconnection is not available right away, use addStream event instead: session.sessionDescriptionHandler.on('addStream', function() { console.log('stream ...
Read more >
pc/peerconnection.cc - src - Git at Google
bool SafeSetError(webrtc::RTCErrorType type, webrtc::RTCError* error) { ... RTC_CHECK(!IsUnifiedPlan()) << "AddStream is not available with Unified Plan ".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found