javascriptweb-audio-apicreatejssoundjs

How to set position correctly in SoundJS for Firefox, IE


I'm trying to use SoundJS to play sn mp3 file and seek to a specific position. I'm using:

instance.setPosition(10000);

which works correctly in Google Chrome. But in Mozilla Firefox I hear the sound playing from the correct position, and a second instance of the sound also playing from another position.

In Internet Explorer, the sound starts playing again from the beginning.

Here's a jsFiddle (with autoplaying sound) and here is the complete javascript:

createjs.Sound.registerPlugins([createjs.WebAudioPlugin, createjs.HTMLAudioPlugin, createjs.FlashPlugin]);
createjs.Sound.addEventListener("fileload", handleLoad);
createjs.Sound.registerSound("http://ivdemo.chaseits.co.uk/enron/20050204-4026(7550490)a.mp3", "sound");

function handleLoad(event) {
    var instance = createjs.Sound.play("sound");
    var ten = document.getElementById('ten-secs');
    ten.addEventListener('click', function (event) {
        instance.setPosition(10000);
    });
}

What am I doing wrong for Firefox and IE?


Solution

  • As I commented on in your other question, there was a bug with in a previous version of SoundJS which should be fixed in the latest available on github. You can test this behavior yourself with the TestSuite example.

    Nice use of jsfiddle to demonstrate the issue, by the by.

    Hope that helps.