Last post Mar 21, 2007 09:08 AM by harshal_shravgi
Mar 21, 2007 05:32 AM|harshal_shravgi|LINK
I have some wav files in one folder called "WAV". That folder is in application folder.
These wav files are actually some recorded telephone calls. These wav files are raw i.e. these could be played directly in window media player. For playing them I have to append an AU file format to it. After this I play it in Window media player plug-in.
But my problem is I cann't keep the working wav files on server for some security reasons. So whenever a user requests some call record to play, then I take that file, append it AU format and then play it.
It was working fine on our LAN but when I launched it on internet it is not working at all.
I will explain u my code which I used to play the wav file.
1) I am using one media player plug-in which accepts the URL of the wav file and plays it on website. e.g. of URL -
http://192.168.1.3/MIS/harry.wav (This is local path which is being played on website but only on LAN)
2) COde to get this URL -
sAppPath = Request.ServerVariables("APPL_PHYSICAL_PATH") ' Using this I got application path
sServerIP = Request.ServerVariables("LOCAL_ADDR") ' Using this I got server's IP address to create URL
host = System.Net.Dns.GetHostByAddress(Request.ServerVariables.Item("REMOTE_HOST"))
sClientName = host.HostName ' Here I get client's machine name because
' I create the new wav file with client machine name to identify it uniquely
Dim sSecond As String = Now.Second
sFileTargetPath = Trim(sAppPath) & Trim(sClientName) & Trim(sSecond) & ".wav" ' This create unique
' file to distinguish between users
sFileDeletePath = Trim(sAppPath) & Trim(sClientName) ' This deletes any previous files created by same user
If Dir$(sFileDeletePath & "*") <> "" Then Kill(sFileDeletePath & "*")
lblError.Text = ex.Message
hiddenPhysicalPath.Value = sFileTargetPath
sSourceFilePath = sAppPath & "wav\ch" & Trim(lblChNo.Text) & "\" & Trim(sDate) & "\" & Trim(lblRecNo.Text) & ".wav"
' Above string gets the particular file that I want to play.
' Please note that the wav file at above path is raw file i.e. without AU file format
sFilePath = FunG_AuFileFormat(sSourceFilePath, sFileTargetPath)
' Now above function called FunG_AuFileFormat copies the raw file from sSourceFilePath append it that AU file format then
' create one new file at that sFileTargetPath.
Now I play this file at path sFileTargetPath by using its virtual path as follows -
Dim sVirtualPath As String = Request.ApplicationPath
sVirtualPath = sVirtualPath.Replace("\", "/")
sFilePath = "http://" & Trim(sServerIP) & sVirtualPath & "/" & Trim(sClientName) & Trim(sSecond) & ".wav"
Now I pass this URL to that media player plug-in.
All this is working fine on LAN but giving error on internet. On internet I checked the URL that I get above in sFilePath
it should be something like http://126.96.36.199/MIS/harsh15.wav
But instead of this it shows local Ip address as -
http://192.168.1.3/MIS.harsh15.wav . I think because of this that file is not played. So please tell me how could I play those wav files in my web site.
Mar 21, 2007 08:25 AM|aghausman12|LINK
Please have a view at the following articles.
Mar 21, 2007 09:08 AM|harshal_shravgi|LINK
I think I have got my problem. My problem is not with the IP address.
I actually try to create a new wav file on server with the name of client. And then append it that AU tag. When I did it locally, that new wav file is created in application folder.
But when I did it through internet that file is not created. I have given write permissions to that application.
Firstly tell me that my logic of creating temporary file on server and then tagging it, is correct or not. Another option is downloading that selected raw wav file on client side then tagging it and then playing it.
But I don't know how to do another option. So please tell me how could I create new wav file on server.