Hello,
I am trying to play mp3 files in an embeded Media Player object (HTML). The audio files are stored on a separate server (that the web server can access).
I manage to make to work just fine using a network path for the file (\\myserver\folder\test.mp
3) but I do not feel comfortable to let people see my network paths on the html code of my web page. That is why, as my website is developed in plain ASP, i tried to stream the audio file by using the ADODB.Stream object available in asp.
I then got 2 pages, test_mp3.html that embed Media Player (see following code)
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<OBJECT id="VIDEO" width="320" height="240"
style="position:absolute; left:0;top:0;"
CLASSID="CLSID:6BF52A52-39
4A-11d3-B1
53-00C04F7
9FAA6"
type="application/x-oleobj
ect">
<PARAM NAME="URL" VALUE="
http://myserver/mywebsite/testing/stream_mp3.asp"
>
<PARAM NAME="SendPlayStateChangeE
vents" VALUE="True">
<PARAM NAME="AutoStart" VALUE="False">
<PARAM name="uiMode" value="full">
<PARAM name="PlayCount" value="1">
<PARAM name="enabled" value="True">
</OBJECT>
</body>
</html>
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
---
And stream_mp3.asp (see following code) that streams the file from the server
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
---
<%
Dim strFile
strFile = "\\myserver\folder\test.mp
3"
Response.Buffer = True
Response.Clear
Response.ContentType = "audio/mpeg"
Set objStream = Server.CreateObject("ADODB
.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFile
Response.BinaryWrite objStream.Read
objStream.Close
Set objStream = Nothing
Response.End
%>
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
---
But apparently, media player does not recognize this page as an mp3 file and can not retrieve it. I could easily use \\myserver\folder\test.mp3
on the URL parameter of the <object> instead to make it work but as i said before i do not want people to see the network path for security reasons.
Is there any way to make this system work ? If not, what is the workaround ?
Thanks in advance for your replies.
Start Free Trial