Class AudioPlayer
Definition
- Assembly:
- Tizen.AIAvatar.dll
Represents an audio player capable of streaming and playing audio with support for audio ducking.
public class AudioPlayer : IDisposable
- Inheritance
-
objectAudioPlayer
Constructors
View SourceAudioPlayer(AudioOptions)
Initializes a new instance of the AudioPlayer class.
Declaration
public AudioPlayer(AudioOptions audioOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioOptions | audioOptions | Optional audio options for playback configuration. |
Properties
View SourceCurrentAudioPlayerState
Gets or sets the current state of the audio player.
Declaration
public AudioPlayerState CurrentAudioPlayerState { get; protected set; }
Property Value
| Type | Description |
|---|---|
| AudioPlayerState |
Methods
View SourceAddStream(byte[])
Adds a new audio buffer to the stream list.
Declaration
public void AddStream(byte[] buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | buffer | The audio buffer to add. |
Destroy()
Destroys the audio player and clears all resources.
Declaration
public void Destroy()
Dispose()
Releases all resources used by the AudioPlayer.
Declaration
public void Dispose()
Dispose(bool)
Releases all resources used by the AudioPlayer.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
IsPrepare()
Determines if the audio player is prepared with a valid stream.
Declaration
public bool IsPrepare()
Returns
| Type | Description |
|---|---|
| bool | True if a valid stream is available; otherwise, false. |
Pause()
Pauses the current audio playback.
Declaration
public void Pause()
Play(byte[], int)
Plays the provided audio buffer.
Declaration
public void Play(byte[] audioBytes, int sampleRate = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | audioBytes | The audio buffer to play. |
| int | sampleRate | Optional sample rate for the audio playback. |
PrepareStreamAudio(int)
Prepare the audio from the stream asynchronously.
Declaration
public void PrepareStreamAudio(int sampleRate = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| int | sampleRate | Optional sample rate for the audio playback. |
Stop()
Stops the current audio playback.
Declaration
public void Stop()