VB icon

Streaming MP3's

Email
Submitted on: 1/5/2015 7:35:00 AM
By: Ron Light (from psc cd)  
Level: Intermediate
User Rating: By 7 Users
Compatibility: ASP (Active Server Pages), VbScript (browser/client side)
Views: 742
 
     This Code when put in any directory will create a HTML page listing all Mp3's in the directory. It also creates a streaming link to the file, so anyone can stream off you MP3's from your server withour downloading them.
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
' for :Streaming MP3's
'**************************************
If you look at this you owe me royalties! Just kidding.
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Streaming MP3's
' Description:This Code when put in any directory will create a HTML page listing all Mp3's in the directory. It also creates a streaming link to the file, so anyone can stream off you MP3's from your server withour downloading them.
' By: Ron Light (from psc cd)
'
' Inputs:None. Just drop it in the directory with your mp3's. This is not a recursive list meaning it only lists those in the current directory.
'
' Returns:Html page with streaming links to all mp3's in current dirrectory.
'**************************************

I streamlined my last example:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<%
On Error Resume Next
Dim FileSystemObject, Folder, FileCollection, File
Dim FolderPath, WebDir
	If Request.QueryString("play") >"" Then
	Response.Write "<EMBED src=" & chr(34) & Request.QueryString("play") & chr(34) 
	Response.Write " width=350 height=43 controls=console volume=80"
	Response.Write " width=350 loop=false type='audio/mp3'>"
	Response.Write "<BR>"
	End If
Server.ScriptTimeOut=1
FolderPath= server.MapPath(".") & "\"
WebDir= Request.ServerVariables("PATH_INFO")
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
'List All Files
Set Folder = FileSystemObject.GetFolder(Folderpath)
Set FileCollection = Folder.Files
For Each File In FileCollection
		s = LCase(File.Name)
		If ucase(Right(File.name,4))=".MP3" Then
			Response.Write "<A href=" & chr(34) & webdir & "?Play=" & File.name & chr(34) & ">" & File.name & " FileSize=" & File.size & "</A><BR>"
		Else
			'Code To display other file types with a regular link
			'Response.Write "<A href=" & chr(34) & webdir & f1.name & chr(34) & ">" & f1.name & " FileSize=" & f1.size & "</A><BR>"
		End If
Next
%>
</BODY>
</HTML>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.