.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Play Audio using media player

Posted By: Prema G     Posted Date: March 27, 2012    Points:5   Category :ASP.Net
Hello frends,
I am creating an web application for Music Player,my requirement is to play any online audio file,i have tried used object and embed tags but it works with static urls like-http://sound21.mp3pk.com/Dil%20De%20De%20Bandeya.mp3

But with dynamic link-http://www.dhingana.com/play/raabta/MjAwOTM3/pop/1
it doesnt work...
So how to do it?

With Regards,
Prema G

Author: Prema G             
Posted Date: March 27, 2012     Points: 20   

Thanks sasi for ur reply...
i am using visual studio 2008 with c#..

i have used the folowing code-
But it is not playing for dynamic links.

protected void btnPlay_Click(object sender, EventArgs e)
string mySourceUrl = this.txtMusicLink.Text;
lblmp3.Visible = true;
lblmp3.Text = this.createmediaplayer(mySourceUrl); // binding the music player object to label to play music in player
catch (Exception ex)

//Function to create object for music player that plays song from both online/offline
private string createmediaplayer(string sourceUrl)
string myObjectTag = "";
sourceUrl = sourceUrl + "";
sourceUrl = sourceUrl.Trim();
myObjectTag = myObjectTag + "<object id='MediaPlayer' width='350' height='42' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading Windows Media Player components...' type='application/x-oleobject' >";

myObjectTag = myObjectTag + "<param name='url' value='" + sourceUrl + "' />";
myObjectTag = myObjectTag + "<param name='src' value='" + sourceUrl + "' />";
myObjectTag = myObjectTag + "<param name='AUTOPLAY' VALUE='1'/>";
myObjectTag = myObjectTag + "<embed type='application/x-mplayer2' src='" + sourceUrl + "' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' name='MediaPlayer' uimode='none' width='300' height='42'>";

myObjectTag = myObjectTag + "</object>";
return myObjectTag;


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend