Hi,

I have some code that I'd like to embed into my Simplemachines index.template.php which will add the JW FLV Player underneath our big orange flash banner here:

http://forums.brap.fm

This is the code that I have (and yes, I've uploaded the JW script and files to the webserver):

<html>

<head>

<title>Media Player - Shoutcast/Icecast Streams</title>

<script type="text/javascript" src="swfobject.js">
</script>

</head>

<body>

<div id="player">
<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a>
to see this player.
</div>

<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf', 'streambaby', '600', '20', '7');
so.addVariable('type', 'mp3');
// Shoutcast stream - Brap.FM
so.addVariable('file', 'http://212.72.165.26:9418/;stream.nsv');
so.write('player');
</script>

</body>

</html>

I have a test page up here:

http://labs.brap.fm/player.html

Now, I understand that I need this bit:

<script type="text/javascript" src="swfobject.js">

and this bit:

<div id="player">
 <a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a>
 to see this player.
 </div>

and also this bit:

<script type="text/javascript">
 var so = new SWFObject('mediaplayer.swf', 'streambaby', '600', '20', '7');
 so.addVariable('type', 'mp3');
 // Shoutcast stream - Brap.FM
 so.addVariable('file', 'http://212.72.165.26:9418/;stream.nsv');
 so.write('player');
 </script>

But I don't know how to put it all together. I'm usually pretty good at figuring these thing out but this one has me stumped.

Here's my latest attempt:

echo '
<script type="text/javascript" src="swfobject.js">

<div id="player"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a>to see this player.</div>';

echo '<script type="text/javascript">
var so = new SWFObject('mediaplayer.swf', 'streambaby', '600', '20', '7');
so.addVariable('type', 'mp3');
// Shoutcast stream - Brap.FM
so.addVariable('file', 'http://212.72.165.26:9418/;stream.nsv');
so.write('player');
</script>';

Which doesn't appear to want to work.

Can someone please advise me on where I'm going wrong? I'm almost there, just need a gentle push in the right direction. I've tried <?php and ?> but that doesn't work either. It's slightly annoying as I worked out how to embed the orange flash banner on my own!

Thanks!

    Slightly different attempt, still no luck:

    echo '<script type="text/javascript" src="swfobject.js"></script>';
    
    echo '<div id="player"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a>to see this player.</div>';
    
    echo '<script type="text/javascript">
    var so = new SWFObject('mediaplayer.swf', 'streambaby', '600', '20', '7');
    so.addVariable('type', 'mp3');
    // Shoutcast stream - Brap.FM
    so.addVariable('file', 'http://212.72.165.26:9418/;stream.nsv');
    so.write('player');
    </script>';
    

    I have a feeling it's something to do with the quotes and semicolons? My brain can't work it out. I'm not much of a coder :/

      5 days later
      2 years later
      Write a Reply...