...

View Full Version : embedding audio and having it play on a long page



tpeck
07-27-2011, 11:05 AM
I use an audio solution called flashsound which is not crossbrowser, but that's OK because my projects only require IE.

When I embed a swf file I place it at the top of the page in the <head> section, like this:



<head>
...
<script src="../../../../js/flashsound.js" type="text/javascript" language="javascript1.2"></script>
<script>
var mySoundObj1 = new FlashSound();
mySoundObj1.embedSWF("../../../../media/lessons/L01/lesson1.swf");
</head>


On a short .html page it will play when I use an onclick method to access the .swf.

But on a very long page, it doesn't always play UNLESS I first scroll down to the bottom of the page and up again - at least past the instance of the onclick.

OK, so why not place the embed at the bottom of the long page? Because I've tried that, and then it often doesn't seem to play at all.

My question is, what is the way embedding works on long pages? And, if I must, how do I force the page on loading to read everything but still open at the top of the page?

I guess I could provide a demo if necessary.

tpeck
07-31-2011, 04:44 AM
For reference, the answer is to place the embed not in the header, but as close to the <body> tag as possible. In my case:


<head>
<script src="flashsound.js" type="text/javascript" language="javascript1.2"></script>
</head>

<body>
<script>
var mySoundObj1 = new FlashSound();
mySoundObj1.embedSWF("myswf.swf");
</script>
...
</body>

tpeck
08-13-2011, 09:36 AM
I thought I had solved this, but still there is a problem. If I place the embed close to the <body> tag, it causes an unsightly flash for a second while loading the long page.

So if I place the embed at the other end (directly above </body>), the flashing is eliminated, but there are loading problems.

Does anyone know why an embed just above </body> will play the sound file on a laptop at 1360x768 resolution without having to scroll the long page to the bottom. But on a big monitor screen at 1920x1200 res, the sound file won't play when clicked on until scrolling to the very bottom?

It's odd behaviour - I don't understand it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum