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?
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.
Just, after two more years since the last comment, I stumbled upon this question. I assume the OP's software is C#, as he wants to use NAudio.
Exactly that is done in the QIRX SDR (Open Source, I'm the author), by using P/Invoke and a suitable wrapper,without using IMFByteStream.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.