jfversluis / Plugin.Maui.Audio

Plugin.Maui.Audio provides the ability to play audio inside a .NET MAUI application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possibility to add samples/bytes to a constantly playing audio player

SineVector241 opened this issue · comments

Is it possible to instantiate a constantly playing audio player that is able to have bytes/samples added to it? Currently working on a VOIP application and came across this library however it does not look like I can add bytes/samples to an audio player. Is this possible to implement or am I missing something from reading the examples.

Also realised can't set the sample rate

I have same issue.
I have a stream buffer that I want to expand with audio chunks. I am extending the same Stream object that I used to create the player like this: audioPlayer = audioManager.CreatePlayer(stream);. Unfortunately, the player is currently ignoring the append operation.

Is this an issue on a specific platform or all platforms?

Currently, I've tried on Windows and Android. I believe updating the MediaElement during playback using Stream is not possible. I attempted it this way:

long currentPosition = currentStream.Position;
try
{
    currentStream.Seek(0L, SeekOrigin.End);
    newStream.Seek(0L, SeekOrigin.Begin);
    newStream.CopyTo(currentStream);
}
finally
{
    currentStream.Position = currentPosition;
}

The stream is expanding, but the playback stops where it would have ended before the extension.

In UWP, we have the option to use MseStreamSource. In this case, we should modify the AudioPlayer constructor from MediaSource.CreateFromStream to MediaSource.CreateFromMseStreamSource.