Here is the page. I am trying to dinamically load a playlist with all mp3s contained in a specific folder, using the proper filesystem objects.
In detail, that page tries to read all mp3 files and builds a javascript array, then pass that object as playlist parameter to the flowplayer library.
But problem occurs when the filename contains special characters, like &,+,-,single quote,... and so on. For certain characters I solved with replace function (& transformed to &26), but it does not work for +,-, & and single quote
Is there a way to bypass this?
Just replace the word "quote" with the single quote symbol.
I'm forced to do this because single quote generate problems to forum as well...
<% @Page Language="VB" %>
<% @Import Namespace="System.Web.UI" %>
<% @Import Namespace="System.IO" %>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="flowplayer-3.1.1.min.js"></script>
<title>Flowplayer test</title>
</head>
<body>
<div id="page">
<h1>Flowplayer</h1>
<div style="display:block;width:400px;height:80px" id="player"></div>
<script language="javascript">
var mylist=new Array() ;
var j=0;
var temp=quotequote;
</script>
<% Dim di As DirectoryInfo = New DirectoryInfo("m:7")
Dim CodedURL as string
For Each fi As FileInfo In di.GetFiles()
If fi.Extension=".mp3" Then
CodedURL=replace(fi.name,"'","quote")
%>
<script language="javascript">
temp=(quotehttp://sirio:81/stream/7/<%=CodedURL%>quote).replace(/&/g, quote%26quote);
temp=temp.replace(/+/g,quote%2Bquote);
temp=temp.replace(/-/g,quote%3Aquote);
mylist[j]=temp;
document.write(temp +quote<br>quote);
j++;
</script>
<% End If
Next
%>
<script language="javascript">
flowplayer("player", "./flowplayer-3.1.1.swf",
{playlist: mylist,
plugins: {
controls: {fullscreen: false, url: 'flowplayer.controls-3.1.1.swf',playlist: true, backgroundColor: '#aedaff',
tooltips: {buttons: true}
},
audio: {url: 'flowplayer.audio-3.1.0.swf'}
}
});
</script>
</div>
</body>
</html>