supported property

bool supported

Checks if Real Time Communication (RTC) APIs are supported and enabled on the current platform.

Implementation

static bool get supported {
  // Currently in Firefox some of the RTC elements are defined but throw an
  // error unless the user has specifically enabled them in their
  // about:config. So we have to construct an element to actually test if RTC
  // is supported at the given time.
  try {
    new RtcPeerConnection({
      "iceServers": [
        {"url": "stun:localhost"}
      ]
    });
    return true;
  } catch (_) {
    return false;
  }
  return false;
}