Click here to Skip to main content
15,883,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I'm trying to using the embedded window media player in MVC to play .wav files.
I'm pretty much succeeded in playing all the other formats but somehow .wav files (which i actually need ) are messing it up and WMP is not playing them below is my code.
In View


XML
<object id="mediaPlayer" type="application/x-oleobject" width="100%" height="100%" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"  >

                       <param name="URL" value=""  />
                       <param name="enabled" value="true" />
                       <param name="animationatStart" value="1" />
                       <param name="transparentatStart" value="true" />
                       <param name="autoStart" value="false" />
                       <param name="showControls" value="true" />
                       <param name="Volume" value="-300" />
                       <param name="ShowDisplay" value="0"/>
                       <param name="ShowGotoBar" value="0"/>
                       <param name="ShowControls" value="1"/>
                 <param name="ShowAudioControls" value="1"/>

                   </object>


and this is my javascript code

C#
document.getElementById("mediaPlayer").URL = "E:\\HyperEngine\\Recordings\\20141223_193917_026_00_000.WAV";

     document.getElementById("mediaPlayer").controls.play();

everything is fair and good if i give the path of and mp3 file but wav file.anybody's help is really appreciated.
P.S: I know I can also use other media players, this using WMP is the specific requirement so I have to find a solution to this..
Posted
Comments
Sergey Alexandrovich Kryukov 20-Jan-15 11:05am    
First of all, why? What's wrong with more efficient and compatible media containers and codecs?
—SA
SohaibX 20-Jan-15 12:04pm    
As per our client's requirement he is interested in seeing those graphical skins things, which WMP provides on audio files :)
So can I have those on any other containers?
Sergey Alexandrovich Kryukov 20-Jan-15 12:53pm    
Graphical skin and WAV audio? I'm not getting it. And what, the client cannot make it MPEG3 or AAC?
Anyway, I just did not try such player and am not very interested to try. And how about HTML5 "audio" element instead?
—SA
SohaibX 20-Jan-15 13:21pm    
its not upto client to generate audio files, it'll be a recording device.
So is there no way i can play wav files in this media player? if you try the player i coded above, you'll see what i am talking about.
Sergey Alexandrovich Kryukov 20-Jan-15 13:53pm    
Recording device explains your motivation, but still, for the record (pun unintended :-) you could always transcode WAV on the fly or after uploading (depending on your scenario). Wouldn't it be a solution?

About the way to play WAV? I would be surprised to know that it cannot play WAV, but I not interested enough to find out; this is not my concern, but concern of those who created it. I would not use this player anyway...

—SA

As I can see, the content type for WAV, "audio/vnd.wave" was standardized:
http://tools.ietf.org/html/rfc2361[^].

This is my test:
XML
<?xml version="1.0" encoding="UTF-8"?>
<html>
<body>

<audio controls = "controls" >
  <source src="test.wav" />
  <p>Your user agent does not support the HTML5 Audio element.</p>
</audio>

</body>
</html>
It works, but only if I omit type="audio/vnd.wave". I used Mozilla SeaMonkey v.2.30; for other browsers, support of this HTML5 element could be different. I still think it should work on nearly all non-nonsense browsers.

I already mentioned another solution, with transcoding of WAV on the fly or after uploading (I don't know your scenario) and discussed possible performance costs.

—SA
 
Share this answer
 
Comments
SohaibX 21-Jan-15 2:36am    
its the audio tag again,how about something in media player? :)
Sergey Alexandrovich Kryukov 21-Jan-15 2:38am    
I already said, I see no sense in using it. You never tried to object or explain it. Is there anything in your scenario which requires it. Let me point out this: using OLE object is not multi-platform and is considered unsafe, not only proprietary. For some safety-savvy users it may be enough reason never visiting your site again. (Yes, I can see that this is Windows Media Player 9 component, so what?) However, it's less of a problem if you use it in an internal corporate work...
—SA
SohaibX 21-Jan-15 7:09am    
it is actually an intranet application, i just want a audio player with graphical representation of audio file lets say as in soundcloud.
Sergey Alexandrovich Kryukov 21-Jan-15 11:42am    
Aaah, I see... Yes, in fact, HTML5 supported audio is, well less than rudimentary. Anyway, I was surprised that Windows Media Player showed this limitation. I still use it in some cases and can see some minor limitations on some media containers of codecs (not sure in what cases), but not to the extent where WAV is not played... :-)
—SA
SohaibX 21-Jan-15 14:36pm    
well it sure can play wav files... i solved it, it was some other problem with my code :)
WMP surely can play wav files. It was problem at other end :]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900