Hi
I was trying to implement playlist in c#.I have 2 types of files ".flv" ".swf" in the folder.
The problem is when I create xml from code behind..I dont know how to read it ...
Here is the code that I am working on:
Playlist.aspx.cs
public partial class PlayList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//'Add the logical path where your music is contained here
string URLPrefix = "~//Media";
//'Specify your music's file extension here (usually should be ".mp3")
string FileExt = ".flv";// 'CHANGE FILE EXTENSION
//'Get the physical directory
string strRootDir = Server.MapPath(URLPrefix);
//'List the files contained in said directory
ListFiles(URLPrefix, strRootDir, FileExt);
}
protected void ListFiles(string urlPrefix, string strCurrentDir, string FileExt)
{
DirectoryInfo dir = new DirectoryInfo(strCurrentDir);
Array arrFiles = dir.GetFiles("*.flv");
// FileInfo strFile;
Response.Write("<?xml version=1.0 encoding= UTF-8?>");
Response.Write("<playlist>");
Response.Write("<trackList>");
foreach (FileInfo strFile in arrFiles)
{
Response.Write("<track>");
Response.Write("<title>" + strFile.Name + "</title> ");
Response.Write("<creator></creator> ");
Response.Write("<location>Media/" + strFile.Name + "</location> ");
Response.Write("</track>");
}
Response.Write("</trackList>");
Response.Write("</playlist>");
}
}
I can see xml on the page when I go to page source :
Now this is what i am doing in Playlist.aspx
<object id="presentation" width="891" height="666" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
align="middle">
<param name="flashvars" value="file=PlayList.aspx&autostart=true&repeat=li st&linktarget=_blank" />
<embed src="Media/mediaplayer.swf" quality="high" width="891" height="666" bgcolor="#000000" name="index" align="middle" allowScriptAccess="sameDomain"
name="presentation" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer\"
border="0" allowfullscreen="true"/ >
</object>
I dont know how to read xml that i made on page :
This code shows player on the page but doesnt play anything ... i think
param name="flashvars" is messed up...
I will really appreciate any help!!!