Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

RTCDataChannel.onbufferedamountlow

This article needs a technical review. How you can help.

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

The RTCDataChannel.onbufferedamountlow property is an EventHandler which specifies a function the browser calls when the bufferedamountlow event is sent to the RTCDataChannel. This event, which is represented by a simple Event object, is sent when the amount of data buffered to be sent falls to or below the threshold specified by the channel's bufferedAmountLowThreshold.

See "Buffering" in Using WebRTC data channels to learn more about how to work with the data channel buffer.

Syntax

RTCDataChannel.onbufferedamountlow = function;

Value

A function which the browser will call to handle the bufferedamountlow event. This function receives as its only input parameter a simple Event object representing the event which has occurred.

Example

This example responds to the bufferedamountlow event by fetching up to 64kB of a file represented by an object source and calling RTCDataChannel.send() to queue up the retrieved data for sending on the data channel.

pc = new RTCPeerConnection();
dc = pc.createDataChannel("SendFile");

/* ... */

pc.onbufferedamountlow = function() {
  if (source.position <= source.length) {
    dc.send(source.readFile(65536));
  }
}

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browser
The definition of 'RTCDataChannel.onbufferedamountlow' in that specification.
Working Draft Initial specification.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support

46.0

44 (44) ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support 46.0 44 (44) ? ? ? 46.0

Document Tags and Contributors

 Contributors to this page: Sheppy, rolfedh, jpmedley
 Last updated by: Sheppy,