Search Tools Links Login

Streaming MP3's


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.

Original Author: Ron Light

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.

API Declarations

If you look at this you owe me royalties! Just kidding.

Code

I streamlined my last example:





<%
  On Error Resume Next
  Dim FileSystemObject, Folder, FileCollection, File
  Dim FolderPath, WebDir
If Request.QueryString("play") >"" Then
  Response.Write "   Response.Write " width=350 height=43 controls=console volume=80"
  Response.Write " width=350 loop=false type='audio/mp3'>"
  Response.Write "
"
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 "" & File.name & " FileSize=" & File.size & "
"
Else
'Code To display other file types with a regular link
'Response.Write "" & f1.name & " FileSize=" & f1.size & "
"
End If
  Next
%>

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 90 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.