How to use the @twilio/webrtc/lib/util.guessBrowser 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 / lib / defaults.js View on Github external
enumerable: true,
      value: env[option]
    });
  }
  return defaults;
}, {
  dominantSpeaker: true,
  networkQuality: true,
  topology: 'peer-to-peer',
  testStability: 'all' // other choices: 'stable', 'unstable'
});

// NOTE(mroberts): Firefox, since it doesn't support "max-bundle", really slows
// down with the number of ICE candidates it has to gather; therefore, in our
// tests, we disable ICE servers and trust our host candidates work out.
if (guessBrowser() === 'firefox') {
  defaults.iceServers = [];
}

module.exports = Object.seal(defaults);
github twilio / twilio-video.js / lib / connect.js View on Github external
}
  options.log = log;

  // NOTE(mmalavalli): Print the "dscpTagging" deprecation warning once if the log-level
  // is at least "warn", i.e. neither "error" nor "off".
  if (shouldPrintDscpTaggingWarning && log.level !== 'error' && log.level !== 'off') {
    didPrintDscpTaggingWarning = true;
    log.warn([
      'The ConnectOptions flag "dscpTagging" is deprecated and scheduled for removal.',
      'Please use "enableDscp" instead.'
    ].join(' '));
  }

  // NOTE(mroberts): Print the Safari warning once if the log-level is at least
  // "warn", i.e. neither "error" nor "off".
  if (guessBrowser() === 'safari'
    && !didPrintSafariWarning
    && (log.logLevel !== 'error' && log.logLevel !== 'off')) {
    didPrintSafariWarning = true;
    log.warn([
      'This release of twilio-video.js includes experimental support for',
      'Safari 11 and newer. Support for Safari is "experimental" because,',
      'at the time of writing, Safari does not support VP8. This means you',
      'may experience codec issues in Group Rooms. You may also experience',
      'codec issues in Peer-to-Peer (P2P) Rooms containing Android- or',
      'iOS-based Participants who do not support H.264. However, P2P Rooms',
      'with browser-based Participants should work. Please test this release',
      'and report any issues to https://github.com/twilio/twilio-video.js'
    ].join(' '));
  }

  if (typeof token !== 'string') {
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 / lib / guessbrowser.js View on Github external
'use strict';

const guess = require('@twilio/webrtc/lib/util').guessBrowser();

module.exports = {
  isChrome: guess === 'chrome',
  isFirefox: guess === 'firefox',
  isSafari: guess === 'safari'
};
github twilio / twilio-video.js / lib / signaling / v2 / peerconnectionmanager.js View on Github external
'use strict';

const { guessBrowser } = require('@twilio/webrtc/lib/util');
const PeerConnectionV2 = require('./peerconnection');
const MediaTrackSender = require('../../media/track/sender');
const QueueingEventEmitter = require('../../queueingeventemitter');
const util = require('../../util');
const { MediaConnectionError } = require('../../util/twilio-video-errors');

const isFirefox = guessBrowser() === 'firefox';

/**
 * {@link PeerConnectionManager} manages multiple {@link PeerConnectionV2}s.
 * @extends QueueingEventEmitter
 * @emits PeerConnectionManager#candidates
 * @emits PeerConnectionManager#description
 * @emits PeerConnectionManager#iceConnectionStateChanged
 * @emits PeerConnectionManager#trackAdded
 */
class PeerConnectionManager extends QueueingEventEmitter {
  /**
   * Construct {@link PeerConnectionManager}.
   * @param {IceServerSource} iceServerSource
   * @param {EncodingParametersImpl} encodingParameters
   * @param {PreferredCodecs} preferredCodecs
   * @param {object} options
github twilio / twilio-video.js / lib / util / support.js View on Github external
function isSupported() {
  return !!guessBrowser()
    && isGetUserMediaSupported()
    && isRTCPeerConnectionSupported();
}
github twilio / twilio-video.js / lib / signaling / v2 / peerconnection.js View on Github external
makeUUID,
  oncePerTick
} = utils;

const IceBox = require('./icebox');
const DefaultIceConnectionMonitor = require('./iceconnectionmonitor.js');
const DataTrackReceiver = require('../../data/receiver');
const MediaTrackReceiver = require('../../media/track/receiver');
const StateMachine = require('../../statemachine');
const Log = require('../../util/log');
const IdentityTrackMatcher = require('../../util/sdp/trackmatcher/identity');
const OrderedTrackMatcher = require('../../util/sdp/trackmatcher/ordered');
const MIDTrackMatcher = require('../../util/sdp/trackmatcher/mid');
const workaroundIssue8329 = require('../../util/sdp/issue8329');

const guess = guessBrowser();
const isChrome = guess === 'chrome';
const isFirefox = guess === 'firefox';
const isSafari = guess === 'safari';

const firefoxMajorVersion = isFirefox
  ? parseInt(navigator.userAgent.match(/Firefox\/(\d+)/)[1], 10)
  : null;

const isRTCRtpSenderParamsSupported = typeof RTCRtpSender !== 'undefined'
  && typeof RTCRtpSender.prototype.getParameters === 'function'
  && typeof RTCRtpSender.prototype.setParameters === 'function';

let nInstances = 0;

/*
PeerConnectionV2 States