问题
I'm new to this site and I hope someone can help me with my problem. I am using a Delphi language. And I would want to play a memorystream to windowsmediaplayer ActiveX. Is this possible? If it is, can someone give me a hint or something.. sample code maybe. Thanks.
回答1:
I can't speak for Delphi 2009, but earlier version of Delphi didn't support this with the TMediaPlayer component. What you could do is write the MemoryStream to a temporary file, then have the TMediaPlayer load that file. That's going to be the easiest solution, though admittedly not ideal.
回答2:
Not a free solution, but there is a commercial SDK, BoxedAppSDK, which allows you to access in-memory files as if they were on disk. One of their samples includes a media player accessing a file from memory.
http://www.boxedapp.com/boxedappsdk/
回答3:
Years ago Nils Haeck posted an example on how to play an avi from a TMemoryStream on NLDelphi. He couldn't get it to play mp3's though. For that you should be looking at other solutions, like Un4Seen Bass
The code: playfrommemory.zip
来源:https://stackoverflow.com/questions/680098/delphi-play-memorystream-in-wmp-activex