Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 NAudio 库中的 BufferedWaveProvider 从 Internet 播放 mp3 文件。如何获取有关当前位置和轨道长度的信息?可能吗?
您可以使用从 BufferedWaveProvider 的 Read 方法中读取的字节数来计算当前位置,并使用 WaveFormat 的 AverageBytesPerSecond 属性将其转换为 TimeSpan。
至于 MP3 文件的持续时间,不幸的是,在流式传输完成之前这将是未知的。