Displaying flash player problem with swfobject

1,859 views
Skip to first unread message

philippe barriol

unread,
Feb 5, 2013, 8:05:12 AM2/5/13
to swfo...@googlegroups.com
Hi

I have embed mp3 flash player on my website (PHP and SQL data with
musics).

For now, I just test flash mp3 player. The playlist is xml
configurable with a file 'load.xml'.

When I start the test page to display the player with wamp server (local)
there is noway to dispay the player with swfobject

Could you give me a solution to display the player please ?

Thanks in advance.

Here is a part of the code  :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Index </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="flash/swfobject/swfobject.js"></script>
       
</head>

<body>
<p>
<a href=?lang=fr><img src=images/fr_flag.gif border=0></a>
<a href=?lang=en><img src=images/gb_flag.gif border=0></a>
</p>
<?php // Affichage des drapeaux de choix de langue ?>

    <!-- --------------------- FORMULAIRE DU MOTEUR DE RECHERCHE AVANCE  ---------------------->
    <form name="form_recherche" method="post" action="index_recherche.php">
   
        <!-- FIELDSET  Recherche -->
        <fieldset> <legend><?php echo $text['recherche_avancee'];?></legend> <!-- Titre du fieldset -->
                     
                    <p> <label><?php echo $text['genre']; ?></label>  <?php include("includes/liste_genre.php"); ?> </p>
                    <p> <label><?php echo $text['ambiance']; ?></label>  <?php include("includes/liste_moods.php"); ?> </p>
                    <p> <label><?php echo $text['instrument'];?> </label>  <?php include("includes/liste_instrument.php"); ?> </p>
                    <p> <label><?php echo $text['artiste'];?> </label>  <?php include("includes/liste_artist.php"); ?> </p>
                   
        </fieldset> <!-- Fin fielset Vous êtes intêréssé(e)s par -->
        <!-- Bouton de validation du Formulaire -->
    <input name="submit_form_recherche" type="submit" value="Rechercher"/>
    </form>  
 
    <script type="text/javascript">
        var flashvars = {};
        flashvars.xml_path = "load/load.xml?nocache="+new Date();
        var params = {};
        params.wmode = "transparent";
        swfobject.embedSWF("flash/index.swf", "myContent", "358", "357", "9", "flash/swfobject/expressInstall.swf",flashvars,params);
    </script>
   
     
      <div id="myContent">
            <h1>Alternative content</h1>
            <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
      </div>

     
    <!-- FIN AFFICHAGE DU LECTEUR -->
   
 
  
</body>
</html>




--

 

Aran Rhee

unread,
Feb 5, 2013, 11:11:11 AM2/5/13
to swfo...@googlegroups.com
Hi Phillipe.

It is a bit hard to give a 100% reason as to why it is not working without having a link to the actual page (so that paths to files can be debugged etc). Most likely you have a bad path to your swf or xml file.

A few things I can see in the code to improve are:

1) move your <script> block into the <head> section. SWFObject will execute its code onDOMReady, so it is better to put it into the <head> so it can execute before any page rendering happens.

2)  If you change nocache="+new Date() to new Date.getTime(), this will give you a millisecond accurate number to avoid collisions etc.

3) Unless you really need the artwork below the swf to show through, avoid the use of wmode=transparent. It brings all sorts of bad browser bugs.


Anyhow, I would suggest you run a debugger like firebug or Chrome developer tools while looking at your page. It will show any bad file paths or js errors in the console and help you work out what is going wrong. 

Note - You should also be testing http://localhost rather than file:// if you are not doing so already.


Hope that helps.

Aran


--
You received this message because you are subscribed to the Google Groups "SWFObject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swfobject+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

bluesman78

unread,
Jun 18, 2013, 6:47:22 AM6/18/13
to swfo...@googlegroups.com
Hi

In fact my code does work with IE, but this code does not work with Mozilla Firefox 21.0. (impossible to display the player with firefox only)

Do you have any solution ?

Thanks in advance.

jholm...@gmail.com

unread,
Jun 18, 2013, 8:32:03 AM6/18/13
to swfo...@googlegroups.com

This works on my site:

PHP code

<link rel="stylesheet" type="text/css" href="css/HeadingWPlayerandDropDownMenu.css" />

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

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

<script type="text/javascript">swfobject.registerObject("myMP3Player", "9.0.0");             </script>

</head>

<body>

<div id="pageSpacer1"><h2><span>css Spacer</span></h2></div>

<center>

<div id="musicPlayer">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="450" height="20" id="myMP3Player">

                                                                <param name="movie" value="black-gold-mp3-player.swf" />

                                                                <param name="play" value="true" />

                                                                <param name="loop" value="true" />

                                                                <param name="quality" value="high" />

                                                                <!--[if !IE]>-->

                                                                <object type="application/x-shockwave-flash" data="black-gold-mp3-player.swf" width="450" height="20">

                                                                <param name="play" value="true" />

                                                                <param name="loop" value="true" />

                                                                <param name="quality" value="high" />

                                                                <!--<![endif]-->

                                                                                <a href="http://www.adobe.com/go/getflashplayer">

                                                                                                <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />

                                                                                </a>

                                                                <!--[if !IE]>-->

                                                                </object>

                                                                <!--<![endif]-->

                                                </object>

</div>

 

CSS code:

#musicPlayer {

    position: relative;

    top: -15px;

    margin: 0px 0px 0px 0px;

    text-decoration:none;

    width: 450px;

    height: 20px;

                z-index: 40;

--

Reply all
Reply to author
Forward
0 new messages