问题
I'm developing an XNA rhythm game in C# and because it's a rhythm game it's gonna need a song editor, which is going to need precise video & audio seeking & resuming for the songs. I tried MediaPlayer and VideoPlayer classes but both of them cannot seek a specific position, as PlayPosition is read only. Does anyone know a good way to achieve this? Also, it needs to be able to play .mp3 files, so I can't use XACT. The rhythm game osu! is also coded in XNA and somehow it plays mp3 files and allows seeking as well.
EDIT: By the way, this is specifically for PC
EDIT2: Also, I'm on XNA 4.0
回答1:
Since you're on PC, you can probably interop out to talk to the core DX functionality. I don't know how well this will play with XNA, but if there's any hope of it working, it would probably be with the Microsoft.DirectX.AudioVideoPlayback.Video
class:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms902629.aspx
来源:https://stackoverflow.com/questions/9353583/audio-video-playback-with-seeking-in-xna