Jump to content

HIDDEN DIV AND IFRAME -> PLAY SOUND ON BG


crashmaster

Recommended Posts

I dont know, where this topic should I post...

 

Hi there, I have index.php which every 60 seconds does AJAX request (checking if user has a new messages), and if response is positive AJAX inputs into HIDDEN <div> (style="display:none")  => iframe, where is mp3 player is..

 

But the problem is: if <div> is hidden - sound doesn't play

if <div> isn't hidden - it's shows IFRAME where I can see player, and the sound is played..

 

Any idea's how to play sound on background without showing hidden div and iframe ??

 

HTML:

<body>
<div id="play_sound" style="display:none"></div>
...
{JS code}
</body>

 

{JS code} is:

        function check_updates() {

                   var RESP = $.ajax({
                      type: 'post',
                      url : '/pages/ajax/check_updates.php',
                      cache: false,
                      async: false
                    }).responseText;

                    if (RESP != ''){
                        $('#play_sound').html('<iframe src="http://www.dnbstep.cz/pages/ajax/play_sound.php" border="0" width="0" height="0"></iframe>');
                    }
                    setTimeout("check_updates()",60000);
      }
      setTimeout("check_updates()",60000);

 

PLAY_SOUND.php CODE is:

 

<embed
  src="../../files/prehravac/player.swf"
  width="300"
  height="100"
  allowscriptaccess="always"
  allowfullscreen="true"
  flashvars="file=../../alarm.mp3&autostart=true"
/>

 

Btw: all PATH's are good.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.