Skip to content

Commit

Permalink
RTCEncodedAudioFrame - draft docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Aug 11, 2023
1 parent 43a6c30 commit a59d39a
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 0 deletions.
27 changes: 27 additions & 0 deletions files/en-us/web/api/rtcencodedaudioframe/data/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "RTCEncodedAudioFrame: data property"
short-title: data
slug: Web/API/RTCEncodedAudioFrame/data
page-type: web-api-instance-property
browser-compat: api.RTCEncodedAudioFrame.data
---

{{APIRef("WebRTC")}}

The **`data`** property of the {{domxref("RTCEncodedAudioFrame")}} interface returns a buffer containing the encoded frame data.

## Value

An {{jsxref("ArrayBuffer")}}.

## Examples

TBD

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
57 changes: 57 additions & 0 deletions files/en-us/web/api/rtcencodedaudioframe/getmetadata/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: "RTCEncodedAudioFrame: getMetadata() method"
short-title: getMetadata()
slug: Web/API/RTCEncodedAudioFrame/getMetadata
page-type: web-api-instance-method
browser-compat: api.RTCEncodedAudioFrame.getMetadata
---

{{APIRef("WebRTC")}}

The **`getMetadata()`** method of the {{domxref("RTCEncodedAudioFrame")}} interface returns an object containing the metadata associated with the frame.

This includes information about the frame, including: audio encoding used, the synchronization source and contributing sources, and the sequence number (for incoming frames).

## Syntax

```js-nolint
getMetadata()
```

### Parameters

None.

### Return value

An object with the following properties:

- `synchronizationSource`
- : A positive integer value indicating synchronization source ("ssrc") of the stream of RTP packets that are described by this frame.
A source might be something like a microphone, or some kind of mixer app that combines multiple sources.
All packets from the same source share the same time source and sequence space, and so can be ordered relative to each other.
Note that two frames with the same value refer to the same source.
- `payloadType`
- : A positive integer value in the range from 0 to 127 that describes the format of the RTP payload.
The mappings of values to formats is defined in RFC3550.
- `contributingSources`
- : An {{jsxref("Array")}} of sources (ssrc) that have contributed to the frame.
Consider the case of a conferencing application that combines audio from multiple users.
The `synchronizationSource` would include the ssrc of the application, while `contributingSources` would include the ssrc values of all the individual audio sources.
- `sequenceNumber`
- : The sequence number of an incoming audio frame (not used for outgoing frames) that can be used for reconstructing the original send-order of frames.
This is number between 0 and 32767 .
Note that while numbers are allocated sequentially when sent, they will overflow at 32767 and restart back at 0.
Therefore to compare two frame sequence numbers, in order to determine whether one is assumed to be after another, you must use [serial number arithmetic](https://en.wikipedia.org/wiki/Serial_number_arithmetic). <!-- [RFC1982] -->

## Examples

TBD

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
38 changes: 38 additions & 0 deletions files/en-us/web/api/rtcencodedaudioframe/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: RTCEncodedAudioFrame
slug: Web/API/RTCEncodedAudioFrame
page-type: web-api-interface
browser-compat: api.RTCEncodedAudioFrame
---

{{APIRef("WebRTC")}}

The **`RTCEncodedAudioFrame`** of the WebRTC Encoded Transform API represents an encoded audio frame.

WebRTC script transforms for audio are applied to objects of this type.

{{AvailableInWorkers}} <!-- dedicated workers only: -->

## Instance properties

- {{domxref("RTCEncodedAudioFrame.timestamp")}} {{ReadOnlyInline}}
- : Returns the timestamp at which sampling of the frame started.
- {{domxref("RTCEncodedAudioFrame.data")}}
- : Return a buffer containing the encoded frame data.

## Instance methods

- {{DOMxRef("RTCEncodedAudioFrame.getMetadata()")}}
- : Returns the metadata associated with the frame.

## Examples

TBD

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
27 changes: 27 additions & 0 deletions files/en-us/web/api/rtcencodedaudioframe/timestamp/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: "RTCEncodedAudioFrame: timestamp property"
short-title: timestamp
slug: Web/API/RTCEncodedAudioFrame/timestamp
page-type: web-api-instance-property
browser-compat: api.RTCEncodedAudioFrame.timestamp
---

{{APIRef("WebRTC")}}

The readonly **`timestamp`** property of the {{domxref("RTCEncodedAudioFrame")}} interface indicates the time at which frame sampling started.

## Value

A positive integer containing the sampling instant of the first byte in this frame, in microseconds.

## Examples

TBD

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

0 comments on commit a59d39a

Please sign in to comment.