Sound doesn't play on StartOfLayout event

0 favourites
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • I'm not able to play any sound on StartOfLayout event on android version 4.4.*. It works fine on other android versions. What could be the possible reason and how to solve this?

    I have heard that browser does not allow sound play until user taps on the screen at least once. Is that the reason? Then why its working fine on other versions of android OS?

  • I'm not able to play any sound on StartOfLayout event on android version 4.4.*. It works fine on other android versions. What could be the possible reason and how to solve this?

    I have heard that browser does not allow sound play until user taps on the screen at least once. Is that the reason? Then why its working fine on other versions of android OS?

    move your music file from music folder to sound folder

  • It is already in sound folder.

  • Also, I'm using android's webView for playing this worksheet using index.html file(not the cordova plugin). Kindly help.

  • it sounds overly simple but maybe add a "wait" ? if the OS actually doesnt allow music until first touch you may be able to use the "on Nth touch" option, but i havent much experience with it. not a solution, just figured id help snowball some ideas.

  • no, touch trigger problem is only with music files NOT SOUNDS.

    see manual Scirra:

    ______________________________________________________

    Mobile limitations

    Safari on iOS and Chrome for Android share a limitation in playing music. While sound effects can be played at any time, music is only allowed to start playing when the user touches the screen. This is a limitation in the browsers themselves. As a result, if you play music on the start of layout, you may find in these browsers it does not actually start until the next touch.

    _______________________________________________________

    for this reason i suggest to try move musics on sound folder and preload sound on project settings

  • I tried both the suggestions by NN81 & the_Shit_hawk, But nothing worked for me..

  • I tried both the suggestions by NN81 & the_Shit_hawk, But nothing worked for me..

    but is an apk or an browser game?

  • It's the browase game. I'm running it using android WebBrowser component in my android App.

  • Mobile web browsers actually prevent any audio playback until the first touch. After that sound can play at any time, but music is still limited to only being started in touches. There is no workaround in the browser, it's a limitation to stop websites annoying you with sound. If you build an APK, it doesn't have the restriction.

  • I had the same suspect ASHLEY. But then why only on ver 4.4. Thanks anyway.

  • NN81

    Mayfly

    I have two escenarios:

    1. If the music files are under the "Music" C2 folder and you're listening music on your android device and open the app; the music of the game start to play only when you touch the screen and the music that you were listening stops.

    2. If the music files are under the "Sounds" C2 folder and you're listening music on your android device and open the app; the music of the game start to play without user interaction and the music that you were listening don't stops (both musics plays at the same time).

    Does anyone knows a way to start the app music without interaction and stop the music that you were listening?

    Thanks

  • If you build an APK, it doesn't have the restriction.

    I didn't realize that, I assume it's the same for IOS?

    (I always thought it was daft that an IOS game HAD to have a touch to start sound!)

  • Any resolve on this one? I am having the same issue - sound from either the SOUNDS or the MUSIC will not play "on start of layout" unless I click the mouse first. I have tried both folders and I have tried a wait action, but this is simply the preview in the Chrome browser. Could this be a C3 bug?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did this with my projects and it always works in C2.

    Let's try in C3. :)

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