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
https://forums.phpfreaks.com/topic/143867-hidden-div-and-iframe-play-sound-on-bg/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.