How to set position correctly in SoundJS for Firefox, IE

末鹿安然 提交于 2019-12-06 09:14:04

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/23081203/how-to-set-position-correctly-in-soundjs-for-firefox-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!