Dynamic rich media component for ASP.Net Flash, Video and Audio controls for C# and VB.Net
Welcome Guest Search | Active Topics | Members | Log In | Register

Pass mp3 URL programmatically Options · View
Guest
Posted: Tuesday, July 15, 2008 4:07:14 AM
Rank: Guest
Groups: Guest

Joined: 7/20/2007
Posts: 53,654
Points: 100,812
Hi
I am using the Suite and have successfully inserted the license file.
I have a page which plays an mp3 just fine, but now
I would like to pass the URL to the control when the page loads, not hard coded.
Can this be done in VB? I Have tried eg. like this ( where SelectedFile
is set to the required mp3 filename in the code behind onLoad)

<ASPNetAudio:Audio ID="Audio1" runat="server"
AudioURL="~/mp3/<%=SelectedFile%>">
</ASPNetAudio:Audio>
Same for the play button.

It does not give an error, but does not play the file either.

Please sort me out!
Thanks
Clive
Jake
Posted: Monday, July 28, 2008 7:22:14 AM
Rank: Administration
Groups: Administration

Joined: 7/26/2007
Posts: 676
Points: 1,728
Location: USA
Yeah - just set the VideoURL property using VB

http://www.aspnetmedia.com
CliveHoggar
Posted: Monday, October 06, 2008 11:01:27 AM
Rank: Newbie
Groups: Member

Joined: 10/6/2008
Posts: 1
Points: 3
I am using this page markup
<form id="form1" runat="server">
<div>

<ASPNetAudio:Audio ID="Audio1" runat="server" AudiURL=""
AutoPlay="False" Streaming="True" AudioURL="~/mp3/<%=strFileName%>" >
</ASPNetAudio:Audio>

</div>
<ASPNetMediaGUI:PlayButton ID="PlayButton1" runat="server"
AssociatedControl="Audio1">
</ASPNetMediaGUI:PlayButton>
<ASPNetMediaGUI:StopButton ID="StopButton1" runat="server"
AssociatedControl="Audio1">
</ASPNetMediaGUI:StopButton>
</form>

and a page load event

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strFileName As String = "21-09-2008.mp3"
End Sub
</script>

It does not run like thisbut if the file name is hard coded it runs OK

Is the page load event the wrong one to set the value of strFileName?

Or I am going in the wrong direction?

Help!

Clive
Dave
Posted: Monday, October 13, 2008 5:57:38 PM
Rank: Administration
Groups: Administration

Joined: 7/20/2007
Posts: 305
Points: -2,485
Location: Primarily in New York, USA
Clive,

I'd either set the AudioURL in the code behind, or with a method. However what you're doing should work, if the syntax were correct, which I'm not sure that it is.

Try this:

Code:

<ASPNetAudio:Audio ID="Audio1" runat="server"
AutoPlay="False" Streaming="True" AudioURL='<%= "~/mp3/" + strFileName %>' >
</ASPNetAudio:Audio>


otherwise:

Code:


Audio1.AudioURL = "~/mp3/" + strFileName;



or (this is pseudocode really, don't copy and paste)

Code:


ASPX:

<ASPNetAudio:Audio ID="Audio1" runat="server"
AutoPlay="False" Streaming="True" AudioURL='<%= getURL() %>' >
</ASPNetAudio:Audio>

C# Codebehind:

getURL()
{
  return "~/mp3/" + strFileName;
}




good luck

-dave
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.