How to use the webrtc-adapter.browserShim function in webrtc-adapter

To help you get started, we’ve selected a few webrtc-adapter 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 collab-project / videojs-record / test / test-helpers.js View on Github external
applyScreenWorkaround() {
        // use polyfill in Firefox for now, see:
        // https://blog.mozilla.org/webrtc/getdisplaymedia-now-available-in-adapter-js/
        if (adapter.browserDetails.browser === 'firefox') {
            adapter.browserShim.shimGetDisplayMedia(window, 'screen');
        }
    },
github webcom-components / reach / src / definitions / Browser.js View on Github external
* @property {number} [minVersion] - current browser's minimum supported version
 * @property {boolean} compatible - is current browser supported ?
 */
const browser = Object.assign({
  compatible: !/\s/.test(adapter.browserDetails.browser)
    && (!adapter.browserDetails.minVersion
      || adapter.browserDetails.version >= adapter.browserDetails.minVersion)
}, adapter.browserDetails);

const version = `Reach v${SDK_VERSION} | Schema ${SCHEMA_VERSION} | Webcom v${Webcom.SDK_VERSION}`; // eslint-disable-line no-undef
let message = '';
if (browser.version === null) {
  message = 'Unsupported browser: browser must support WebRTC Peer-to-peer connections to use Reach';
} else if (browser.minVersion && browser.minVersion > browser.version) {
  message = `Unsupported browser: browser is outdated, update to latest version (${browser.minVersion}+)`;
} else if (!adapter.browserShim) {
  message = 'No shim for your browser. There might a problem with your package.';
}

// Log browser status & SDKs versions on load
let args = [`${version} ${message}`];
if (/^(chrome|firefox)$/.test(browser.browser)) {
  args = [
    `%c ${version} %c ${message}`,
    `background: ${browser.compatible ? 'blue' : 'red'}; color: #fff; font-weight: bold`,
    `color: ${browser.compatible ? 'inherit' : 'red'}`
  ];
}

console.log(...args); // eslint-disable-line no-console

export default browser;
github ksocha / twilio-screensharing / client / src / components / App / AppContainer.js View on Github external
componentDidMount() {
    if (adapter.browserDetails.browser === "firefox") {
      adapter.browserShim.shimGetDisplayMedia(window, "screen");
    }
  }
github apidaze / apidaze-js / src / index.js View on Github external
const isWebRTCSupported = function() {
  return (
    typeof WebRTCAdapter.browserDetails === "object" &&
    typeof WebRTCAdapter.browserShim === "object"
  );
};

webrtc-adapter

A shim to insulate apps from WebRTC spec changes and browser prefix differences

BSD-3-Clause
Latest version published 8 months ago

Package Health Score

75 / 100
Full package analysis

Similar packages