How to use the @twilio/webrtc/lib/util/sdp.getSdpFormat function in @twilio/webrtc

To help you get started, we’ve selected a few @twilio/webrtc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twilio / twilio-video.js / test / integration / spec / util / simulcast.js View on Github external
'use strict';

const assert = require('assert');
const { guessBrowser } = require('@twilio/webrtc/lib/util');
const { getSdpFormat } = require('@twilio/webrtc/lib/util/sdp');
const { getMediaSections, setSimulcast } = require('../../../../lib/util/sdp');
const { RTCPeerConnection, RTCSessionDescription } = require('@twilio/webrtc');
const { DEFAULT_CHROME_SDP_SEMANTICS } = require('../../../../lib/util/constants');

const isChrome = guessBrowser() === 'chrome';
const sdpFormat = getSdpFormat(DEFAULT_CHROME_SDP_SEMANTICS);

describe('setSimulcast', () => {
  let answer1;
  let answer2;
  let offer1;
  let offer2;
  let pc1;
  let pc2;
  let stream;
  let trackIdsToAttributes;

  if (!isChrome) {
    it('should not run the setSimulcast integration tests', () => {});
    return;
  }
github twilio / twilio-video.js / test / integration / spec / localparticipant.js View on Github external
'use strict';

const assert = require('assert');
const { DEFAULT_CHROME_SDP_SEMANTICS } = require('../../../lib/util/constants');
const sdpFormat = require('@twilio/webrtc/lib/util/sdp').getSdpFormat(DEFAULT_CHROME_SDP_SEMANTICS);

const {
  connect,
  createLocalAudioTrack,
  createLocalTracks,
  createLocalVideoTrack,
  LocalDataTrack,
  LocalVideoTrack
} = require('../../../lib');

const LocalTrackPublication = require('../../../lib/media/track/localtrackpublication');
const RemoteAudioTrack = require('../../../lib/media/track/remoteaudiotrack');
const RemoteAudioTrackPublication = require('../../../lib/media/track/remoteaudiotrackpublication');
const RemoteDataTrack = require('../../../lib/media/track/remotedatatrack');
const RemoteDataTrackPublication = require('../../../lib/media/track/remotedatatrackpublication');
const RemoteVideoTrack = require('../../../lib/media/track/remotevideotrack');
github twilio / twilio-video.js / lib / signaling / v2 / transport.js View on Github external
constructor(name, accessToken, localParticipant, peerConnectionManager, ua, options) {
    options = Object.assign({
      InsightsPublisher,
      NullInsightsPublisher,
      SIPJSMediaHandler: DefaultSIPJSMediaHandler,
      sdpFormat: getSdpFormat(),
      userAgent: getUserAgent()
    }, options);
    super('connecting', states);

    const eventPublisherOptions = {};
    if (options.wsServerInsights) {
      eventPublisherOptions.gateway = options.wsServerInsights;
    }

    const EventPublisher = options.insights ? options.InsightsPublisher : options.NullInsightsPublisher;
    Object.defineProperties(this, {
      _eventPublisher: {
        value: new EventPublisher(
          accessToken,
          SDK_NAME,
          SDK_VERSION,
github twilio / twilio-video.js / lib / signaling / v2 / twilioconnectiontransport.js View on Github external
constructor(name, accessToken, localParticipant, peerConnectionManager, wsServer, options) {
    options = Object.assign({
      InsightsPublisher,
      NullInsightsPublisher,
      TwilioConnection,
      maxReconnectAttempts: MAX_RECONNECT_ATTEMPTS,
      reconnectBackOffJitter: RECONNECT_BACKOFF_JITTER,
      reconnectBackOffMs: RECONNECT_BACKOFF_MS,
      sdpFormat: getSdpFormat(options.sdpSemantics),
      userAgent: getUserAgent()
    }, options);
    super('connecting', states);

    const eventPublisherOptions = {};
    if (options.wsServerInsights) {
      eventPublisherOptions.gateway = options.wsServerInsights;
    }

    const EventPublisher = options.insights ? options.InsightsPublisher : options.NullInsightsPublisher;
    Object.defineProperties(this, {
      _accessToken: {
        value: accessToken
      },
      _automaticSubscription: {
        value: options.automaticSubscription
github twilio / twilio-video.js / lib / signaling / v2 / peerconnection.js View on Github external
isRTCRtpSenderParamsSupported,
      logLevel: DEFAULT_LOG_LEVEL,
      offerOptions: {},
      revertSimulcastForNonVP8MediaSections,
      setBitrateParameters,
      setCodecPreferences,
      setSimulcast,
      IceConnectionMonitor: DefaultIceConnectionMonitor,
      MediaStream: DefaultMediaStream,
      RTCIceCandidate: DefaultRTCIceCandidate,
      RTCPeerConnection: DefaultRTCPeerConnection,
      RTCSessionDescription: DefaultRTCSessionDescription
    }, options);

    const configuration = getConfiguration(options);
    const sdpFormat = getSdpFormat(configuration.sdpSemantics);
    const isUnifiedPlan = sdpFormat === 'unified';

    const localMediaStream = isUnifiedPlan ? null : new options.MediaStream();
    const logLevels = buildLogLevels(options.logLevel);
    const RTCPeerConnection = options.RTCPeerConnection;

    if (options.enableDscp === true) {
      options.chromeSpecificConstraints = options.chromeSpecificConstraints || {};
      options.chromeSpecificConstraints.optional = options.chromeSpecificConstraints.optional || [];
      options.chromeSpecificConstraints.optional.push({ googDscp: true });
    }

    const peerConnection = new RTCPeerConnection(configuration, options.chromeSpecificConstraints);

    if (options.dummyAudioMediaStreamTrack) {
      peerConnection.addTrack(options.dummyAudioMediaStreamTrack, localMediaStream || new options.MediaStream());