Imported music not playing r275

0 favourites
  • 11 posts
From the Asset Store
In this template the music plays without looping in your game
  • Hi,

    I just loaded up C2 as I've been using C3 for a while and the latest update is r275 (64bit).

    Is anyone having issue playing music files on Start of Layout? Doesn't seem to work anymore, although I was able play imported Sounds fine. Old projects work ok, just new ones created fresh in r275. I can import the same projects into C3 and they also work, what's going on, anyone had this issue ? ;)

    Cheers,

    Jay.

    Tagged:

  • Try using a user input to start sound.

    It's a security measure.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don't think that would the case as it works in C3 this way, and all my previous projects sound work fine using On Start of Layout in this version. It's only when I start a fresh project that the problem occurs.

  • You would know if it worked if you tried it.

  • I'm not interested in another method when it worked right before and works just the same in C3.

    I don't want the user to start the music anyway, I want it to start as the level begins - the way everyone usually does it.

    All I asked was whether anyone else had the same issue with this version.

  • Its not another method if its the only method.

    The browser spec has changed. It changed well over a year ago.

    Note, your local preview may allow sound to play at the beginning if you have used the method recently.

    developers.google.com/web/updates/2017/09/autoplay-policy-changes

  • Then why do my old projects still work? Why does the same method work in C3?

  • A user input is required for sound, in general, to play on start of your game, in Construct 2 and Construct 3.

    Once the audio engine is started, you should be able to use the "Play" action of the Audio plugin, without issue.

    This actually does not depend on Construct but on the device you will play your game. iOS is far more restrictive on that end for example.

    Also, possibly the C3 runtime has different audio code (although, I'm really not sure this is the case) than Construct 2.

    You should provide a copy of your project with audio that is failing as well as exact reproduction steps, what you expect your project to be doing, what you experience it doing instead.

  • As I already stated, I wanted to know if any other users experienced the same.

    I totally understand that browsers have started to prevent autoplay for music. The question is now, "why do my old files still work that were created in C2". Not only do they still play startup music fine in Firefox, but the same files work in C3 desktop too!

    Additionaly, C3 allows you to use 'on Start' to play music still, and it works in Firefox no problem.

    A work around is to preload the music file by placing it in the Sounds folder instead of the Music folder - no user input required. Although, yes I do know that it will be loaded into memory which may not be desirable for some.

    For this topic an example file isn't required, otherwise I would have included one.

    I'm sorry that I enquired now.

  • The rules around autoplay are quite complex, vary between browsers, and are not always consistent, e.g. in some cases it depends on the domain the page is on and whether the browser has internally whitelisted it for autoplay. However any existing loopholes are likely to be closed in future, so it's true that the only reliable way to play audio, is to wait for the first user input event. Construct handles this automatically, so you can just play audio whenever (including in 'On start of layout') and Construct will ensure it plays at the earliest opportunity.

  • My old projects were not hosted as they weren't compiled into anything, just C2 files - I'm just a bit surprised they still work ok. Again I was also surprised that C3 still works this way for me too.

    Anyway, I'll keep this all in mind in the future, thanks Ashley.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)