Sound Cuts Off Before Completing in Google Chrome
The audio doesn't play for the entire duration. It plays and stops partway, but seems to register as complete. I have an 'on complete' event. When the audio completes, the play/pause button changes from displaying the 'pause' icon to the 'play' icon. This happens the moment the audio stops, even if it didn't play for the entire duration.
This only happens intermittently and only in Google Chrome. I've found other posters in Stack Overflow who experienced this, but the question was asked a long time ago and I didn't see a suitable answer.
I'm currently using Adobe Animate 21.0 to produce HTML5 Canvas content.
It never occurs in IE/Edge. I have also not experienced this when loading in Chrome Incognito mode.
I've attached a sample of code. There are a few methods used, but this one is fairly simple, and I'm experiencing this issue.
There are several different events that trigger the sound, depending on the file used. In this example, a button plays/pauses the audio. What appears to happen is that the audio registers as 'complete' before it actually completes. The handleComplete event works as expected, just changes button states, but it sometimes occurs as soon as the audio stops (not when the entire file has played to completion).
mainMovieClip.play_btn.on("click", function(e){
switch (mainMovieClip.play_btn.currentLabel) {
case "uns":
mainMovieClip.play_btn.gotoAndStop("sel");
mainMovieClip.stop_btn.gotoAndStop("uns");
createjs.Sound.stop();
soundInstances.frameAudio = createjs.Sound.play("frameAudio", {volume: 1.0, loop: 0});
soundInstances.frameAudio.on("complete", handleComplete);
break;
case "sel":
mainMovieClip.play_btn.gotoAndStop("vis");
soundInstances.frameAudio.paused = true;
break;
case "vis":
mainMovieClip.play_btn.gotoAndStop("sel");
soundInstances.frameAudio.paused = false;
break;
}
});
