Table of Contents

Class AudioEncoder

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The AudioEncoder interface of the WebCodecs API encodes AudioData objects.

[Value("AudioEncoder")]
public class AudioEncoder : EventTarget
Inheritance
AudioEncoder
Inherited Members

Remarks

Constructors

AudioEncoder()

public AudioEncoder()

AudioEncoder(AudioEncoderInit)

The AudioEncoder() constructor creates a new AudioEncoder object with the provided init.output callback assigned as the output callback, the provided init.error callback as the error callback, and the State set to "unconfigured".

public AudioEncoder(AudioEncoderInit init)

Parameters

init AudioEncoderInit

Remarks

Properties

EncodeQueueSize

The encodeQueueSize read-only property of the AudioEncoder interface returns the number of pending encode requests in the queue.

[Value("encodeQueueSize")]
public ulong EncodeQueueSize { get; }

Property Value

ulong

An integer containing the number of requests.

Remarks

Ondequeue

[Value("ondequeue")]
public EventHandlerNonNull Ondequeue { get; set; }

Property Value

EventHandlerNonNull

State

The state read-only property of the AudioEncoder interface returns the current state of the underlying codec.

[Value("state")]
public CodecState State { get; }

Property Value

CodecState

A string containing one of the following values:

Remarks

Methods

Close()

The close() method of the AudioEncoder interface ends all pending work and releases system resources.

[Value("close")]
public GlobalObject.Undefined Close()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Configure(AudioEncoderConfig)

The configure() method of the AudioEncoder interface enqueues a control message to configure the audio encoder for encoding chunks.

[Value("configure")]
public GlobalObject.Undefined Configure(AudioEncoderConfig config)

Parameters

config AudioEncoderConfig

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Encode(AudioData)

The encode() method of the AudioEncoder interface enqueues a control message to encode a given AudioData object.

[Value("encode")]
public GlobalObject.Undefined Encode(AudioData data)

Parameters

data AudioData

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Flush()

The flush() method of the AudioEncoder interface returns a Promise that resolves once all pending messages in the queue have been completed.

[Value("flush")]
public Task<GlobalObject.Undefined> Flush()

Returns

Task<GlobalObject.Undefined>

A Promise that resolves with undefined.

Remarks

IsConfigSupported(AudioEncoderConfig)

The isConfigSupported() static method of the AudioEncoder interface checks if the given config is supported (that is, if AudioEncoder objects can be successfully configured with the given config).

[Value("isConfigSupported")]
public static Task<AudioEncoderSupport> IsConfigSupported(AudioEncoderConfig config)

Parameters

config AudioEncoderConfig

Returns

Task<AudioEncoderSupport>

A Promise that resolves with an object containing the following members:

Remarks

Reset()

The reset() method of the AudioEncoder interface resets all states including configuration, control messages in the control message queue, and all pending callbacks.

[Value("reset")]
public GlobalObject.Undefined Reset()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks