User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Sep 2005
Posts: 2
Reputation: gaborm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gaborm gaborm is offline Offline
Newbie Poster

Sending audio data over HTTP problem

  #1  
Sep 15th, 2005
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: Oklahoma
Posts: 902
Reputation: chrisbliss18 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 21
chrisbliss18's Avatar
chrisbliss18 chrisbliss18 is offline Offline
Posting Shark

Re: Sending audio data over HTTP problem

  #2  
Sep 15th, 2005
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
Reply With Quote  
Join Date: Sep 2005
Posts: 2
Reputation: gaborm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gaborm gaborm is offline Offline
Newbie Poster

Re: Sending audio data over HTTP problem

  #3  
Sep 16th, 2005
Hi,

Thank you!
The problem was exactly the same described in the referred topic.
We had to make a very nasty workaround to store the sessions and override it when media player changes the sesssion id.

Regards,

Gabor
Reply With Quote  
Join Date: Aug 2005
Location: Oklahoma
Posts: 902
Reputation: chrisbliss18 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 21
chrisbliss18's Avatar
chrisbliss18 chrisbliss18 is offline Offline
Posting Shark

Re: Sending audio data over HTTP problem

  #4  
Sep 16th, 2005
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 8:58 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC