Monday, 26 February 2018

play sound through javascript - using flash over html

CITRX! Why do you play choppy sound sometimes when using IE/html5? Bad citrix.

SoundManager can play sounds over flash; if no flash then it will fallback to using html5.
http://www.schillmania.com/projects/soundmanager2/

Put all the sound manager support stuff somewhere in your project



Reference soundmanager2.js from your HTML


Setup the Sound Manager; put the path to where you put the support stuff:

        $(document).ready(function() {
            soundManager.setup({
                // where to find flash audio SWFs, as needed
                url: '@Url.Content("~/Content/swf/")',
                preferFlash: true,
                onready: function() {
                    // SM2 is ready to play audio!
                }
            });
        });


Use the Sound Manager to play a sound

    var mySound = soundManager.createSound({
        url: baseUrl + "Content/Voice/Hello.mp3"
    });

    // ...and play it
    mySound.play();




Citrix!

No comments:

Post a Comment