79266932

Date: 2024-12-10 03:28:09
Score: 3.5
Natty:
Report link

The code in the top-voted answer doesn't work for me. So I want with @HadiAkbarzadeh's answer, which is "handle playback-stopped and play again."

Here's how that looks with NAudio; note that you need to "rewind" the stream to position zero to replay. (Sorry, it's pseudocode-ish, for berevity.)

_waveOut = new WaveOutEvent();
_reader = new VorbisWaveReader("path/to/someAudioFile.ogg");
_waveOut.PlaybackStopped += (sender, args) => {
    _reader.Seek(0, SeekOrigin.Begin);
    _waveOut.Play();
};

That's it! It seamlessly replays after the audio completes.

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • RegEx Blacklisted phrase (2): doesn't work for me
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @HadiAkbarzadeh's
  • Low reputation (0.5):
Posted by: nightblade9