• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to use create.js for seamless background music?

Explorer ,
Aug 09, 2018 Aug 09, 2018

Copy link to clipboard

Copied

Hi, after browsing the web for hours, I managed to find a code that sort of works:

createjs.Sound.on("fileload", handleLoad);

createjs.Sound.registerSound("https://s0.vocaroo.com/media/download_temp/Vocaroo_s03IOthwckn1.mp3", "bgmLoop");

function handleLoad(event) {

  var bgmLoopInstance = createjs.Sound.play("bgmLoop", {

  interrupt: createjs.Sound.INTERRUPT_ANY,

  loop: -1

  });

}

The problems are:

1. The music doesn't loop seamlessly, there's a gap before it starts back again.

2. The music doesn't start in desktop Firefox and Chrome.

Anyone have any ideas how to fix?

I heard howler.js does loops seamlessly, but I have no idea how to use it together with createjs in Animate CC.

Views

1.2K

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

correct answers 1 Correct answer

Community Expert , Aug 10, 2018 Aug 10, 2018

Try this tutorial. It is about looping and may help you fix your issue.

JavaScript beginner tutorial 22 - for loop - YouTube

Votes

Translate

Translate
Aug 10, 2018 Aug 10, 2018

Copy link to clipboard

Copied

Hey there,

Gaps in looping html 5 audio is a common problem.

Not sure about create.js but I found a JavaScript solution for here: Hivenfour/SeamlessLoop · GitHub

My intelligence is quite limited so if you need help in incorporating this GitHub seamless loop into your file, we would need an expert to chime in over here.

Thanks,

Ankush

Votes

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 Expert ,
Aug 10, 2018 Aug 10, 2018

Copy link to clipboard

Copied

LATEST

Try this tutorial. It is about looping and may help you fix your issue.

JavaScript beginner tutorial 22 - for loop - YouTube

Votes

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