Results 1 to 2 of 2

Thread: Problem playing sound file in Opera !

  1. #1
    Join Date
    Oct 2009
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Problem playing sound file in Opera !

    Hi,
    I am having a problem with something below and I'm not sure what it is, I have inserted some Javascript etc to play a sound file via a 'Play' button and a 'Stop' button !
    Everything works fine in IE and Firefox but in Opera the sound file plays onLoad of page and the buttons don,t work !
    I posted a link elsewhere and someone said that Opera has a problem playing .wav files so I changed my sound file to an mp3 but once changed the buttons dont work in any browser, I have posted a snippet of my code below, can anyone help its driving me nuts !!!!!!

    My site is at http://www.eustonfishingclub.com
    if it helps !





    <div id="content"><!-- InstanceBeginEditable name="MainContent" -->

    <h1>The Gallery</h1>
    <p class="intro">This is the Photo Gallery for the Euston Fishing Club</p>
    <p>Here you will find all the photo's from recent trips and outings, please click on an album image to view all the photo's from that particular trip !</p>
    <p>We hope you enjoy the pics and also welcome any photo's of your own ,if you have any please <a href="../Contact/index.html">Contact the Webmaster</a> via e-mail and send any photo's you would like adding to the Gallery.</p>
    <p>Please read the Important caption below if you are having problems viewing the Gallery !</p>

    <!-- #BeginLibraryItem "/Library/Fishing Rod End Text Img.lbi" --><img src="../Assets/Images/Global/fishing_rod.gif" alt="Fishing Rod" class="fishingrodSpacer"/><!-- #EndLibraryItem -->
    <p class="Important"><strong>IMPORTANT !</strong> - To be able to view the photo's properly in the Gallery you need to have Javascript enabled in your browser, if you click on a link to an album below and see the photo's appear then all is well !<br />
    IF NOT you need to <a href="http://www.tranexp.com/win/JavaScript-enabling.htm">Enable Javascript</a> in your browser, instructions on how to do this can be found by clicking on the highlighted link.</p>
    <h2>Euston Fishing Club Photo Albums</h2>
    <p class="intro">If you would like to play a little music while browsing the gallery please click on the player below !</p>

    <!-- Functions Code Block Start-->
    <script>
    /* Here we are creating two functions. The first to start a sound object playing and the second to stop a sound object from playing. */
    //
    // This function, when called will play the sound object
    function EvalSoundPlay(soundobj) {
    var thissound= eval("document."+soundobj);
    thissound.Play();
    }
    // This function, when called will stop the sound object
    function EvalSoundStop(soundobj) {
    var thissound= eval("document."+soundobj);
    thissound.Stop();
    }
    </script>
    <!-- Functions Code Block End-->

    <!-- Here we are embedding the sound file/s. We give each embedded sound a 'name' that we can refer to in a JavaScript event call.
    -----
    // Note: You can have multiple sounds embedded but remember that each sound requires a different 'name' and each would require its own set of play/pause buttons. -->

    <embed src="smooth_bgd.wav" autostart="false" width=0 height=0 name="sound1" repeat="true" loop="true" enablejavascript="true" />

    <div class="musicPlayer"><img src="../Assets/Images/Global/play-button.png" alt="music play button" width="40" height="40" onClick="EvalSoundPlay('sound1')"/><img src="../Assets/Images/Global/stop_button.png" alt="music stop button" width="40" height="40" onClick="EvalSoundStop('sound1')"/></div><!-- End .musicPlayer -->


    <div id="gallery"><div class="photoAlbum">
    <div class="photo"><img src="../Assets/Images/Gallery/Skipton_25_11_09/Skipton_251109_Thumb.jpg" alt="Fisherman Fishing from Boat" width="131" height="98" /></div><!-- End .photo -->

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Have a look here.

    Not all types of sound files work in all types of browsers. This page not only tells you HOW to embed properly (valid code) but which browsers it works (or degrades, or fails) in.

    Nifty.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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