•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 391,946 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,915 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 2125 | Replies: 3
![]() |
•
•
Join Date: Sep 2005
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hi Guys,
We are trying to create a little servlet in Tomcat, which is capable to send audio files over http to an embedded media player. The definition of the player looks like:
...
<OBJECT ID="Mp" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" TYPE="application/x-oleobject" WIDTH="0" HEIGHT="0">
<PARAM name="uiMode" value="none">
<PARAM NAME="ShowControls" VALUE="0">
<PARAM NAME="AutoStart" VALUE="1">
<PARAM NAME="ShowPositionControls" VALUE="0">
<PARAM NAME="ShowStatusBar" VALUE="0">
<PARAM NAME="ShowDisplay" VALUE="0">
</OBJECT>
...
<script language="javascript">document.Mp.URL = "here comes the url of the servlet with item ID";</script>
The servlet reads the audio file and writes its content to the response with the following http header settings:
getResponse().setContentType("audio/x-wav");
getResponse().setHeader("Content-Transfer-Encoding", "binary");
getResponse().setHeader("Pragma", "Public");
getResponse().setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
getResponse().setHeader("Content-Disposition", "inline; filename=Media.wav");
getResponse().setHeader("Content-Length", new Integer(MediaBytes.length).toString());
getResponse().setHeader("Accept-Ranges", "bytes");
So, everything works fine for wav files in Internet Explorer, but we are facing problems with Firefox, where it does not work. The embedded Media Player says that "Windows Media Player cannot play the file. One or more codecs required to play the file could not be found."
But if we set the url to directly to the file on the server, everything works fine.
We have analyzed the HTTP traffic in both situation, but we cannot understand how Internet Explorer/Firefox and Media Player works together:
- how does Media Player know that the audio file is playable?
- if the url points directly to the file, the HTTP headers does not contain any kind of information about the file type, only the extension is available; Media Player checks the file extenion in the url?
- if the url points to the servlet, why Media Player in Firefox cannot determine the file type and throws error?
Any help is greately appreciated!
Thanks!
Gabor
We are trying to create a little servlet in Tomcat, which is capable to send audio files over http to an embedded media player. The definition of the player looks like:
...
<OBJECT ID="Mp" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" TYPE="application/x-oleobject" WIDTH="0" HEIGHT="0">
<PARAM name="uiMode" value="none">
<PARAM NAME="ShowControls" VALUE="0">
<PARAM NAME="AutoStart" VALUE="1">
<PARAM NAME="ShowPositionControls" VALUE="0">
<PARAM NAME="ShowStatusBar" VALUE="0">
<PARAM NAME="ShowDisplay" VALUE="0">
</OBJECT>
...
<script language="javascript">document.Mp.URL = "here comes the url of the servlet with item ID";</script>
The servlet reads the audio file and writes its content to the response with the following http header settings:
getResponse().setContentType("audio/x-wav");
getResponse().setHeader("Content-Transfer-Encoding", "binary");
getResponse().setHeader("Pragma", "Public");
getResponse().setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
getResponse().setHeader("Content-Disposition", "inline; filename=Media.wav");
getResponse().setHeader("Content-Length", new Integer(MediaBytes.length).toString());
getResponse().setHeader("Accept-Ranges", "bytes");
So, everything works fine for wav files in Internet Explorer, but we are facing problems with Firefox, where it does not work. The embedded Media Player says that "Windows Media Player cannot play the file. One or more codecs required to play the file could not be found."
But if we set the url to directly to the file on the server, everything works fine.
We have analyzed the HTTP traffic in both situation, but we cannot understand how Internet Explorer/Firefox and Media Player works together:
- how does Media Player know that the audio file is playable?
- if the url points directly to the file, the HTTP headers does not contain any kind of information about the file type, only the extension is available; Media Player checks the file extenion in the url?
- if the url points to the servlet, why Media Player in Firefox cannot determine the file type and throws error?
Any help is greately appreciated!
Thanks!
Gabor
Check this thread and let me know if it sounds like it addresses your situation. If not, we'll have to look at other possibilities.
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
In case that source is lost, here's the solution for anyone else that may be interested.
•
•
•
•
To whomever cares,
I've got a workaround now. I still do not know for certain if it's a
bug or by-design that the cookies aren't used by the plugin. While
looking through the Netscape Plugin API (NPAPI), I found a function that
one would use to request info from the browser, but no mention was made
of cookies. Perhaps it could be used to pass cookies, and perhaps not.
The long and short of it is that cookies aren't passed.
What I did to work around the problem was to create a new .aspx page to
point the NPAPI plugin at. My <embed> tag points WMP to it and appends
the SessionID to the Url. This new .aspx page takes that param and
updates the session-cookie that WMP is using, then redirects it to the
actual Url to get the video. And, yes, I did take extra precautions to
stop people from using this new page as a backdoor into the site; thanks
for looking out for me. =)
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
access adobe aol audio blind breach broadband code com combo daniweb data data protection data transfer database development drive dropdownlist forensics free government hard hardware hitachi internet java legal linux microsoft sdk for java microsystems module mp3 music net news open platform programming reuse security software sony source storage stream sun terabyte tv web wikipedia
- Taskbar resizes and audio cuts out. Virus?? help :( (Viruses, Spyware and other Nasties)
- memory management in wndows 2000 (Windows NT / 2000 / XP / 2003)
- Winsock C++ help: receiving data (C++)
- Servlet(accepting audio) (JavaScript / DHTML / AJAX)
- Problem with threads (Python)
- Huge Problem Please Help! (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: Need help in figuring logic for a parser
- Next Thread: Applet qns


Linear Mode