S
surf
I got the code below off of Orielly and the download part is commented
out. It allows someone to play a mp3 off of your web server. My friend
has a cheap $10/year 1and1.com account and I couldln't figure out all
what it has, but I just hacked some html and set up a page so people
can play our songs. I then realized however that the file name is right
in the html page and people could probably easily steal the file off
the server. What can I do about that ? What is a better way to easily
allow them to play the mp3 but make it hard to steal it ?
----------------------------------------
<html>
<a href="heighest_heav.mp3" target="_blank"
onclick="javascriptlayerOpen('Ex. 1: Acoustic Guitar',this.href);
return false">Play Some Guitar</a>
<script language="JavaScript" type="text/javascript">
var UniqueID = 314 // Make each link open in a new window
var newWinOffset = 0 // Position of first pop-up
function PlayerOpen(soundfiledesc,soundfilepath) {
PlayWin = window.open('',UniqueID,'width=320,height=190,top=' +
newWinOffset
+',left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
PlayWin.focus();
var winContent = "<HTML><HEAD><TITLE>" + soundfiledesc +
"</TITLE></HEAD><BODY bgcolor='#FF9900'>";
winContent += "<B
style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>"
+ soundfiledesc + "</B>";
winContent += "<OBJECT width='300' height='42'>";
winContent += "<param name='SRC' value='" + soundfilepath + "'>";
winContent += "<param name='AUTOPLAY' VALUE='true'>";
winContent += "<param name='CONTROLLER' VALUE='true'>";
winContent += "<param name='BGCOLOR' VALUE='#FF9900'>";
winContent += "<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE'
LOOP='FALSE' WIDTH='300' HEIGHT='42' CONTROLLER='TRUE'
BGCOLOR='#FF9900'></EMBED>";
winContent += "</OBJECT>";
<!-- winContent += "<p
style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a
href='" + soundfilepath +"'>Download this file</a> <SPAN
style='font-size:10px'>(right-click or Option-click)</SPAN></p>";
-->
winContent += "<FORM><DIV align='center'><INPUT type='button'
value='Close this window'
onclick='javascript:window.close();'></DIV></FORM>";
winContent += "</BODY></HTML>";
PlayWin.document.write(winContent);
PlayWin.document.close(); // "Finalizes" new window
UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 //
subsequent pop-ups will be this many pixels lower
}
</script>
</html>
out. It allows someone to play a mp3 off of your web server. My friend
has a cheap $10/year 1and1.com account and I couldln't figure out all
what it has, but I just hacked some html and set up a page so people
can play our songs. I then realized however that the file name is right
in the html page and people could probably easily steal the file off
the server. What can I do about that ? What is a better way to easily
allow them to play the mp3 but make it hard to steal it ?
----------------------------------------
<html>
<a href="heighest_heav.mp3" target="_blank"
onclick="javascriptlayerOpen('Ex. 1: Acoustic Guitar',this.href);
return false">Play Some Guitar</a>
<script language="JavaScript" type="text/javascript">
var UniqueID = 314 // Make each link open in a new window
var newWinOffset = 0 // Position of first pop-up
function PlayerOpen(soundfiledesc,soundfilepath) {
PlayWin = window.open('',UniqueID,'width=320,height=190,top=' +
newWinOffset
+',left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
PlayWin.focus();
var winContent = "<HTML><HEAD><TITLE>" + soundfiledesc +
"</TITLE></HEAD><BODY bgcolor='#FF9900'>";
winContent += "<B
style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>"
+ soundfiledesc + "</B>";
winContent += "<OBJECT width='300' height='42'>";
winContent += "<param name='SRC' value='" + soundfilepath + "'>";
winContent += "<param name='AUTOPLAY' VALUE='true'>";
winContent += "<param name='CONTROLLER' VALUE='true'>";
winContent += "<param name='BGCOLOR' VALUE='#FF9900'>";
winContent += "<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE'
LOOP='FALSE' WIDTH='300' HEIGHT='42' CONTROLLER='TRUE'
BGCOLOR='#FF9900'></EMBED>";
winContent += "</OBJECT>";
<!-- winContent += "<p
style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a
href='" + soundfilepath +"'>Download this file</a> <SPAN
style='font-size:10px'>(right-click or Option-click)</SPAN></p>";
-->
winContent += "<FORM><DIV align='center'><INPUT type='button'
value='Close this window'
onclick='javascript:window.close();'></DIV></FORM>";
winContent += "</BODY></HTML>";
PlayWin.document.write(winContent);
PlayWin.document.close(); // "Finalizes" new window
UniqueID = UniqueID + 1 // newWinOffset = newWinOffset + 20 //
subsequent pop-ups will be this many pixels lower
}
</script>
</html>