Class: Toybox.Audio.Output.StreamingAudioSource

Overview

Subclass this and override onReadyForData to make a streaming audio source.

Since:

API Level 6.0.3

Instance Method Summary collapse

Instance Method Details

append(buffer as Lang.ByteArray) as Lang.Number

Append bytes to the audio stream.

Returns:

  • Lang.Number —

    The number of bytes that were appended to the stream

Since:

API Level 6.0.3

end() as Void

Indicate that no more data will be added to the stream.

Since:

API Level 6.0.3

getBufferSize() as Lang.Number

Get the size of the internal buffer in bytes.

Since:

API Level 6.0.3

initialize(options as { :format as Audio.AudioFormat, :bufferSize as Lang.Number })

Since:

API Level 6.0.3

onError(error as Output.Error) as Void

This function is called if there is an error while this source is playing.

Parameters:

Since:

API Level 6.0.3

onReadyForData(freeSpace as Lang.Number) as Void

This function is called when the data in the internal buffer gets low, or

  if the buffer is empty when the source is played.

Parameters:

  • freeSpace — (Lang.Number) —

    The space available in the buffer in bytes.

Since:

API Level 6.0.3


Generated Oct 19, 2026, 4:16:38 PM