Play byte [] In MediaElement SetSource As MemoryStream
-
Sunday, May 09, 2010 4:33 AM
Dear Experts,
I am passing url the silverlight object initParam as UNC path, of the file (i.e \\Server11\AudioFiles\simple.wav) that i want to read it and return it back as byte [] of array, using Service Contract, and that's it works fine,
AudioFilesClient.AudioFilesClient afc = new AudioFilesClient.AudioFilesClient(); afc.GetAudioFileStreamCompleted += new EventHandler<AudioFilesClient.GetAudioFileStreamCompletedEventArgs>(afc_GetAudioFileStreamCompleted);
afc.GetAudioFileStreamAsync(_url);The following function that setSource when callback completed:
void afc_GetAudioFileStreamCompleted(object sender, AudioFilesClient.GetAudioFileStreamCompletedEventArgs e) { try { MemoryStream me = new MemoryStream(e.Result); // WaveMSS.WaveMediaStreamSource wvstream = new WaveMSS.WaveMediaStreamSource(me); this.mediaElement.SetSource(me); } catch (Exception ex) { MessageBox.Show("Complete Function : "+ex.Message); } }
It gives me an error like : AG_E_INVALID_FILE_FORMAT ( when i just put memorystream directly).
But when i use the Class WaveMediaStreamSource(mem) and setSource(wvstream); it give me the following:
This when i pass memorystream over WaveMediaStreamSource class : Only PCM format is supported
This when i set the source : AG_E_NETWORK_ERRORPlease, any idea, why this problem??
Thanks
All Replies
-
Sunday, May 09, 2010 10:42 AM
Can't you just use WebClient.OpenReadAsync function to download the file stream? Then you can assign e.Result to the source of the mediaElement.
-
Monday, May 10, 2010 3:39 AM
Can't you just use WebClient.OpenReadAsync function to download the file stream? Then you can assign e.Result to the source of the mediaElement.
I discovered the problem was that the silverlight does not support wav files and when i replace the wav file by mp3 it works fine. Do you have an idea why it does not support wav file??
Thanks
-
Friday, May 14, 2010 3:44 AM
Hi Bassam,
I discovered the problem was that the silverlight does not support wav files and when i replace the wav file by mp3 it works fine. Do you have an idea why it does not support wav file??
Actually, WAV is supported in Silverlight. For the supported formats, please take a look at this link. I guess the problem is that your wav is not a real wav fomat video. To make it work, you can use Expression Encoder to format it.
Best regards,
Jonathan
-
Friday, May 14, 2010 3:54 AM
yes, it's supported only for some audioFormat, i think because the file audio format is not Pcm format, that why it gives me Only Pcm format support. and i can't convert or encode this file to pcm format, do you know a way programitically doing this?
Thanks
-
Friday, May 14, 2010 4:04 AM
Hi Bassam,
Normally, Expression Encoder has provided API for developers. You can call it on code behind. For exmaple, you can refer to the links.
http://blogs.msdn.com/expressionencoder/archive/2008/04/22/8418128.aspx
http://forums.silverlight.net/forums/t/70505.aspx
Best regards,
Jonathan
-
Saturday, May 15, 2010 6:12 AM
But i can't add the libararies to the silverlight project?
-
Saturday, May 15, 2010 8:58 AM
You need to do it on server side, not on Silveright side.
-
Sunday, May 16, 2010 8:13 AM
But in my sitation what i need is to make the recorded voice as small as possible instead of raw audio, so is there a way to do it from the sivliverlight client side before i send it to the server?
Thanks
-
Sunday, May 16, 2010 10:00 AM
Unless you can find a Silverlight media encoder (I don't know if it exists). The Expresion Encoder is not a Silverlight libreary. That's why you can not add the reference to Silverlight project.
You can always send your raw audio back to server to do the conversion before save it to file.
-
Sunday, May 16, 2010 9:56 PM
Hi,
But i can't add the libararies to the silverlight project?
You'd better send the raw video to server side and encode it on server side. Thanks.
Best regards,
Jonathan
-
Monday, May 17, 2010 1:33 AM
What i see is Microsoft Expression Encoder 3 SDK, it encode only a file path,, so what if i have a byte of array, and i want to encode this audio in the memory base. Is it possilbe?
Thanks
-
Tuesday, May 18, 2010 7:04 AM
Encoding was working in my development machine, but when i deploy it to the server, it's not working, i have post a question in expression forums but no one reply?
Thanks for everyone who help me,
-
Wednesday, May 19, 2010 1:08 PM
Either your server need to have the Expresion Encoder installed, or you need to make sure the dlls used in your project are in your bin folder.
If you can not install the Expression on the Server. Make sure you set copy to local = true on the Expression dlls referenced in your project before doing another build.
-
Wednesday, May 19, 2010 1:18 PM
I have installed Encoder 3 on the server, so it's avaible in GAC so, no matter with that, but because some dll like microsoft.encoer.utitlites.dll has some dependencies dlls , that's not avaiable in server 2003, or misssing, if you look at the url i suppled in the previews post, you will see that this ecnoder 3 not support it by microsoft right now, i don't know why microsoft do that, because windows server 2008 it has only 2 years when they release it, it's very strange. really it's very strange.
Thanks
-
Wednesday, May 19, 2010 1:36 PM
Oh, I see now. You are on Server 2003, and Expression Encoder is not supported in server 2003 according to people from MS. But they also said you might be able to make it work if you can find out which dependency dll is missing.
So which dependency dll did you find is missing?
-
Wednesday, May 19, 2010 2:20 PM

-
Wednesday, May 19, 2010 2:39 PM
Why don't you post this screen shot in your other thread to have MS people to tell you how to get those missing dlls.
Here is what I found from the web:
http://pcsupport.about.com/od/findbyerrormessage/a/msvcr90-dll-not-found-missing-error.htm
http://pcsupport.about.com/od/findbyerrormessage/a/msjava-dll-not-found-missing-error.htm
I would still get instruction from MS people first before try to fix it myself. Maybe you just missed some service pack or patch on your server?
-
Wednesday, May 19, 2010 3:44 PM
The 1st, 'MSVCR90.dll' is supposably a part of the 'Microsoft Visual C++ 2008 Redistributable Package (x86)'. So I downloaded it and installed it on the server. I re-ran the 'Depends' tool, and it is still stating that the .dll cannot be found.
2nd, 'WMVACCEL.dll' is supposably a part of the 'Microsoft VC-1 Encoder SDK - Professional' package. So I downloaded it and installed it on the server. I re-ran the 'Depends' tool, and it is still stating that the .dll cannot be found.
and I did a search on the server and found the missing .dll named MSVCR90.dll in the following directory:
C:\Windows\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375Really, i don't know what i am missing??
-
Sunday, May 23, 2010 3:28 AM
I have solved the problem in windows 2003 server, it was because the version of VC is old, so i download the new one so it works fine.
Please, look at this url,
Thanks

