hii m using swf player for playing songs but getting some probem in string
if there become some ['] or [&] signs in my song name link break there what i use that my link don’t break because this type of symbols
here is the code where m posting my url of songs in $url
<script type="text/javascript">
var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF");
so.addVariable("autoPlay", "yes");
so.addVariable("soundPath", "<?php $url ?>");
so.write("flashPlayer");
</script>
To avoid issues like this you can use either htmlentities() or urlencode() which transform symbols such as ’ and & into HTML entities rather then static text.
// URL encoding
so.addVariable("soundPath", "<?php echo urlencode($url); ?>");
// HTML Entities - (recommended)
so.addVariable("soundPath", "<?php echo htmlentities($url); ?>");
but after using this my flash player does not show why ?
well sorry in address bar url showing good but still in player file which code is above mention not working after apply both functions break on & this symbol
Could you please post the output for both urlencode and htmlentities as its hard to debug without either seeing the output in person or by you posting it.
after apply htmlentities got this
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashPlayer">
This text will be replaced by the flash music player.
</div>
<script type="text/javascript">
var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF");
so.addVariable("autoPlay", "yes");
so.addVariable("soundPath", "http://domainname.com/pakistani/coke-studio/Coke Studio Season 4 - Episode 4/Rang Laaga - Sanam Marvi ");
so.write("flashPlayer");
</script>
after apply urlencoded got this
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashPlayer">
This text will be replaced by the flash music player.
</div>
<script type="text/javascript">
var so = new SWFObject("playerSingle.swf", "mymovie", "192", "67", "7", "#FFFFFF");
so.addVariable("autoPlay", "yes");
so.addVariable("soundPath", "http%3A%2F%2domainname.com%2Fpakistani%2Fcoke-studio%2FCoke+Studio+Season+4+-+Episode+4%2FRang+Laaga+-+Sanam+Marvi+");
so.write("flashPlayer");
</script>
but actual path is
=http://http://domainname.com/pakistani/coke-studio/Coke Studio Season 4 - Episode 4/Rang Laaga - Sanam Marvi & Sajjad Ali.mp3
so u can see in both paths that break url before & WHY ?
The URL encoding should have worked but without access to the page it’s hard to see the real source of the problem is.
well i just noticed that after posting encoding +htmlentities url in play file there showing full url but song is not playing still i think some other problem in player which don’t support some symbols for playing? any suggestion from your side
It may very well not be able to read full URL’s, spaces and symbols in the file path but without access to the player its not possible for me to know if that’s true or not.