Playing windows media from memory stream.
This is Windows XP MCE 2005. I found few articles on this as well as other sites which says we can play media using an URL in Media Center that pointed to a file on my hard drive. I have many such media files and would like playing windows media from memory stream. But those provided examples wont work for me. Can anyone please tell me in very simple steps how to do the same? Many Thanks.
Re: Playing windows media from memory stream.
Well it totally depends on kind of SDK you using and what kind of application you are developing. You haven’t provided any information regarding the same so it will be difficult for us to provide any information.
Re: Playing windows media from memory stream.
Thanks for the reply vshori. I’m actually trying to develop an e-learning solution and I want to have windows media files on the hard or the cd-rom encrypted. At runtime I want to decrypt the tutorial in memory an play it from there. Any help now ? Thank you.
Re: Playing windows media from memory stream.
I need to save byte array to the windows media player, too.
For c#, could you give any links for samples?
Re: Playing windows media from memory stream.
Hi selmaguzel,
I have heard that Windows Media Player control cannot work with byte arrays directly. However, you can use something like File.WriteAllBytes(path, data) or alternatively if you don't want to write the file you could convert the byte array to a stream and then play that
Code:
var bytes = File.ReadAllBytes(@"C:\WINDOWS\Media\ding.wav"); // as sample
using (Stream s = new MemoryStream(bytes))
{
// http://msdn.microsoft.com/en-us/library/ms143770%28v=VS.100%29.aspx
System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer(s);
myPlayer.Play();
}