How would I go about being able to use a URI of a binary class.
For example, I need to be able to give the URI for a song, but the song comes for a SQL server which sends it in a binary form, which is on the memory.
OK, I just asked you because I expected you need just to play a song from your application without interacting with Media Player or if you need to play a song file without any information about the software user uses.
So, to convert any file to its binary representative
System.IO.FileStream fs = new System.IO.FileStream(@"FilePath", System.IO.FileMode.Open);
byte fileAsBytes = new byte[fs.Length];
fs.Read(fileAsBytes, 0, fileAsBytes.Length);
To convert it back to stream
System.IO.StreamReader sr = new System.IO.StreamReader(new System.IO.MemoryStream(fileAsBytes));
Yes, but now I am wondering if I did something wrong. I have a SQL server which sends it as binary. The issue is when I have the data I never have the file location. I just have the binary value it returned.
I query the server for a song.
It returns the song as binary. I set the source of the media element to the value returned.
That thirds step is my issue.
Thanks for the help.
So this has nothing to do with files? You have a song stored as binary in the SQL Server and want to use MediaPlayer to play the song, but media player is asking for a URI and you only have a memory buffer?