Click here to Skip to main content
15,896,497 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
come on man bring me out from this sound playing issues i have following code that work fine in IE but not in other browsers what's the solution for that please help me out.

DirectoryInfo di = new DirectoryInfo("C://Users//Public//Music//Sample Music/Kalimba.mp3");
//FileInfo[] fi = di.GetFiles();
string FilePath = di.FullName;
if (BrowserName == "IE")
scr = scr + @"<BGSOUND SRC='" + FilePath + "' LOOP='1'></BGSOUND>";
else if (BrowserName == "Chrome")
{
scr = scr + @"<embed src='" + FilePath + "' ";
scr = scr + @"AUTOSTART='True' name='chm' LOOP='true' height='0' width='0' volume='85'></embed>";
}
else if (BrowserName == "Firefox")
{
scr = scr + @"<embed src='" + FilePath + "' ";
scr = scr + @"AUTOSTART='True' LOOP='true' name='firfox' height='0' width='0' volume='85'></embed>";
}

IE working fine with bgsound tag but other 2 not working although i tried bgsound in other 2 also but didn't work. please give a solution for that. and i wanna play file from user's own localdisk as see in DirectoryInfo.

Regards,
Usman Ali
Posted

1 solution

"and i wanna play file from user's own localdisk as see in DirectoryInfo."

You can't. Your server has no access to the client local disk: the DirectoryInfo you retrieve will for the the server disk, not the client.
 
Share this answer
 
Comments
usmanali.ali843 25-Sep-12 8:46am    
But why it's not playing for chrome and firefox in my above code as it's being playing in IE correctly then what's the problem with the path in chrome and firefox.
usmanali.ali843 26-Sep-12 8:53am    
Is anyone there who can tell me how can i get complete path of files uploaded by client as (C:\Users\Documents\ABC.mp3) given by File Uploader control any other way to get complete path of client's uploaded files in asp.net/C# and in all browsers???????
OriginalGriff 26-Sep-12 9:35am    
You can't. Security won't let you - even by default - know what is behind the client browser (except in special circumstances which do not apply in 99.99% of situation". For all you know, the device browsing to you may not have a drive as you would recognise it: it could be a phone, an Android tablet, or even an internet equipped fridge!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900