Search code examples
javascriptaudiomouseoverhtml5-audiosoundmanager2

Sound Manager 2 basic example redirect problem (mp3 on separate page)


I'm trying to implement the following Audio w/ Sound Manager2 example:

www. shillmania/ projects/ soundmanager2/ demo/ play-mp3-links/ basic.html

I thought I had all the files correctly linked as the debug information is checking out, but the page is redirecting me to a quicktime link in a separate page.

The documentations states: "SoundManager 2 intercepts clicks to MP3 links and plays them inline. The script assigns additional CSS classes to the links to indicate their state (playing/paused, etc.)"

  1. What am I missing?
  2. Can I replace the click events with mouseover events within inline.js? Or would that require a major re-write? My goal is to play a quick sound effect on mouseover events on my menus across all browsers with fallbacks.

    http://www.canvaskit.com/audio_html5/

I appreciate any input, thanks!


Solution

  • My guess is that it's not working because the soundManager settings are being made twice: once in inlineplayer.js...

    soundManager.debugMode = true; // disable or enable debug output
    soundManager.useFlashBlock = true;
    soundManager.url = '../../swf/'; // path to directory containing SM2 SWF
    
    // optional: enable MPEG-4/AAC support (requires flash 9)
    
    soundManager.flashVersion = 9;
    soundManager.useMovieStar = true;
    
    // ----
    
    soundManager.onready(function() {
      if (soundManager.supported()) {
        // soundManager.createSound() etc. may now be called
        inlinePlayer = new InlinePlayer();
      }
    });
    

    ...and again inline with the HTML itself:

    soundManager.url = 'soundmanager/swf/';
    soundManager.flashVersion = 9; // optional: shiny features (default = 8)
    soundManager.useFlashBlock = true; // optionally, enable when you're ready to dive in
    // enable HTML5 audio support, if you're feeling adventurous. iPad/iPhone will always get this.
    //soundManager.useHTML5Audio = true;
    
    // (cut)
    
    soundManager.onready(function() {
      if (soundManager.supported()) {
        alert('Yay, SM2 loaded OK!');   
      } else {
        alert('Oh snap, SM2 could not start.');
      }
    });
    

    The settings conflict, and I imagine that soundManager.url from the HTML is correct but everything else should come from inlineplayer.js. Edit as necessary until each parameter is only set once.