Skip to main content

util

Provides a variety of helpful utilities.

warning

Only the utilities documented here are guaranteed to be present on util. Undocumented utilities can be removed without warning. We don't consider these to be 'breaking changes.'

.browser (string)

if (util.browser === "Firefox") {
/* OK to peer with Firefox peers. */
}

The current browser. util.browser can currently have the values 'firefox', 'chrome', 'safari', 'edge', 'Not a supported browser.', 'Not a browser.' (unknown WebRTC-compatible agent).


.supports (object)

if (util.supports.data) {
/* OK to start a data connection. */
}

A hash of WebRTC features mapped to booleans that correspond to whether the feature is supported by the current browser.

warning

Only the properties documented here are guaranteed to be present on util.supports.

  • .audioVideo (boolean): True if the current browser supports media streams and PeerConnection.
  • .data (boolean): True if the current browser supports DataChannel and PeerConnection.
  • .binary (boolean): True if the current browser supports binary DataChannels.
  • .reliable (boolean): True if the current browser supports reliable DataChannels.