music not looping when published in FF and Chrome

0 favourites
  • 12 posts
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • I have an intro screen with a button and when the button is pressed, the music starts:

    Touch - introButton - play music looping -10 "bgMusic"

    It loops fine in preview but when in browser it does not loop.

    Any idea? Could this be a bug? Should I have system every tick check if music is silent and then start it - which seems crazy tough.

    I have no code to stop it anywhere beside a music button which toggles the sound but I am not touching it during testing to make sure.

    The code for music button is:

    Touch on touched musicBtn audio set toggle silent

    if audio is silent musicBtn set opacity 50

    system else musicBtn ser opacity 100

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • make the music in .wav format, then reimport it. That will assure it will be imported and converted to the correct formats.

    instead of looping does it just stop after 1 play through?

  • I did import a wav format and yes it stops after playing once but just when published. I also change music file to see if that would make a difference but it is the same. Also I checked with other comp I made with same code and they loop so I am not sure what I am doing wrong here. There has to be something but the fact that it does not stop in preview and only when published is strange.

  • BWT when I run in debug mode it shows the looping.

  • when you saw "publishing" you mean you are playing it in Chrome..on a PC?

    bring the music file into Audacity and make sure there's no empty space at the end of the music.

  • I mean exported a HTML5 and playing the html file either locally or from a server.

  • I could PM you a link to the file if you want to look at it.

  • So I turned off everything except the intro button. Still the music stops even though it is set to looping. It just does not make sense.

  • OK. So I think it must be a bug because I made several test files and the same thing happens. So I will post in the bug section.

  • Try putting the file in the sounds folder instead of the music folder.

    and check this:

  • Spacedoubt, you saved my day!

    It is not a Chrome issue only since the same happens in FF and Edge. But putting the music files in the sound folder does correct the not looping issue.

    I make several educational games a week and just started to use C2 and this was a major issue because we are following department of education guidelines and we need the music background to loop!

    THANK YOU!!!!

  • Now that I looked into this music problem, since the music is streaming when put in the music folder, would it be correct to use:

    audio | on tag "bgMusic" ended ||  audio | play music looping at volume 0 db (tag "bgMusic")[/code:wwukk4tc]
    
    I think it might mimik the javascript equivalent:
    
    [code:wwukk4tc]
    myAudio = new Audio('someSound.ogg'); 
    myAudio.addEventListener('ended', function() {
        this.currentTime = 0;
        this.play();
    }, false);
    myAudio.play();
    
    [/code:wwukk4tc]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)