Search code examples
c#naudioaacm4a

Is there a way to play a stream of AAC with NAudio?


The only thing I found was with MediaFoundationReader which seems to work only with files. But I want to play a stream, not a file. Is there a way to do that?


Solution

  • NAudio's Media Foundation support is quite new, so not everything is supported as yet. Unfortunately stream-based playback is one of the features that isn't supported yet.

    Check out this answer from Mark to a similar question about MF support for streams.

    If you're keen to get in and implement it yourself you will need to create a wrapper class that implements the IMFByteStream interface, then adapt the NAudio MediaFoundationReader class to use streams. I did something similar in this answer for the WmaFileReader and WmaStream classes to use a stream-based source for NAudio's Windows Media Audio support.