Sound Cuts Off Before Completing in Google Chrome

Community Beginner ,
Nov 18, 2020 Nov 18, 2020

Copy link to clipboard

Copied

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;		
	
	}
});

 

Views

65

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 18, 2020 Nov 18, 2020

Copy link to clipboard

Copied

what's soundInstances?

 

and are you using that button more than once to play your sound and failing to remove duplicate complete handlers?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 11, 2020 Dec 11, 2020

Copy link to clipboard

Copied

Apologies for not replying sooner - I didn't receive a notification that anyone had responded.

 

The issue seems to have resolved. When the code was first created, everything worked as expected. After a time, the sound would cut off. Now it works again as expected. I'm speculating that Chrome introduced a bug in an update that was resolved shortly thereafter, but the code now works.

 

In answer to your queries:

 

soundInstances is an array of mp3 file names.

 

As to the use of the button - it sounds like you have found an issue. Thank you for that. The button use will be very low as it is intended to play a narrated instruction that is quite short. It's there in case the user misses the autoplay audio. However, I don't want multiple handlers floating around, so thanks very much.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 11, 2020 Dec 11, 2020

Copy link to clipboard

Copied

LATEST

you're welcome.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines