Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
How to play audio on a loop using NAudio library?

I wrote some code that sets new playlist each time at fixed intervals and then plays it, but after the first play, it doesn't play anymore. I still get 55 printed in the console, so my code is running, it's just the player stops working.

if (AlarmSystem.OutputDevice.PlaybackState != PlaybackState.Playing)
{
  var playlist = new ConcatenatingSampleProvider(AlarmSystem.GetTriggeredAlarmsPlaylist());
  AlarmSystem.OutputDevice.Init(playlist);
  AlarmSystem.OutputDevice.Play();

  Console.WriteLine(55);
}

I checked the audio playback also seems to be interrupted even though I am checking for PlaybackState and only run the above code if it's not PlaybackState.Playing.

I tried calling Dispose before also and even recreating OutputDevice but it doesn't play again.

In my code I am getting the new playlist so I can play that one after the old one finishes.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda