tags:

views:

110

answers:

3

Hi,

I've develoved a web application. One of the options of this application is to play audio files that have previously uploaded to the server. I'm trying to do that using the following code:

<object id="MediaPlayer" 
type="application/x-oleobject" height="42" standby="Installing Windows Media Player..." width="138" align="absMiddle" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="FileName" value=path>
</param><param name="AutoStart" value="true">
</param><param name="volume" value="3">
</param><param name="EnableContextMenu" value="1">
</param><param name="TransparentAtStart" value="false">
</param><param name="AnimationatStart" value="false">
</param><param name="ShowControls" value="true">
</param><param name="ShowDisplay" value="false">
</param><param name="ShowStatusBar" value="false">
</param><param name="autoSize" value="false">
</param><param name="displaySize" value="true">
</param></object>

Where 'path' is the path of the audio file that must be played. When I run my application in the server PC I can play audio files. However, when I run my application on a client PC everything works correctly, but when I try to play an audio file I have a problem: the web page is correctly loaded, I can see the player, but it never plays the audio file.

Do you have any idea about how to solve this issue? Thanks in advance.

A: 

I would guess that path to audio file is local file system path (like c:\audio\myfile.mp3)?

If so, the app that is running on the client doesn't have access to the audio file stored on server - it needs to load it using http or whatever protocol is appropriate in this case.

Gregory Mostizky
Hi, yes, path is where the audio file is stored in the server. How could I sent the audio file to the client?
A: 

The path should be the relative path and it must be on a folder that is served by the web server. For example if you are serving the webpage that embeds the video from the root and your media file is in a sub-folder called "videos" you would code it as follows:

<PARAM NAME="FileName" VALUE="videos/videofilename.wmv">

You can test that it is visible on your web server by just trying to load the video from the client directly without the embedding, e.g.

http://www.yoursite.com/videos/videofilename.wmv
Turnkey
A: 

To expand on Gregory Mostizky's answer...

Your code probably looks like this:

<param name="FileName" value="c:\audio\myfile.mp3">

and therefor will a) always work when you look at it (via server or local development), and b) never for anyone else.

Change the path to either an absolute HTTP reference or a relative reference. E.g.:

<param name="FileName" value="http://www.server.com/myapp/myfile.mp3"&gt;
Stu Thompson