Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder tpeck's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    877
    Thanks
    53
    Thanked 6 Times in 5 Posts

    embedding audio and having it play on a long page

    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:

    Code:
    <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.
    The difference between genius and stupidity is that genius has its limits. (Albert Einstein)

  • #2
    Regular Coder tpeck's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    877
    Thanks
    53
    Thanked 6 Times in 5 Posts
    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:

    Code:
    <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>
    The difference between genius and stupidity is that genius has its limits. (Albert Einstein)

  • #3
    Regular Coder tpeck's Avatar
    Join Date
    Oct 2002
    Location
    Sydney, Australia
    Posts
    877
    Thanks
    53
    Thanked 6 Times in 5 Posts
    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.
    The difference between genius and stupidity is that genius has its limits. (Albert Einstein)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •