sound lost if game screen sleep or switching apps on android

  • Problem Description

    I am facing a strange error , if I run it with chrome android browser using wifi , then whenever i switch the windows suddenly it lost the sounds. I am running music behind the application which runs fine but other sounds stop working if i switch the windows. I thought maybe this error is due to the chrome browser so i have build it with crosswalk on XDK and then i ran the application directly on the device. In start everything works fine but if i do not touch the screen and device mode goes into sleep mode then if i wake up the device it get lost all sounds of the buttons except music. So it seems like this is coming from construct2 because running the app on chrome android browser or running as an apk both gives same results.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/104 ... 0game.capx

    Description of Capx

    This is basic application sample space blaster which comes with construct2, i did not change anything in its default code. It runs background music and audio sounds.

    Steps to Reproduce Bug

    • Step 1 : Run the application on wifi and open the chrome browser inside android
    • Step 2 : All sound and music will work fine , now start switching your window.
    • Step 3 : Then switch back to your game window and you will find the music is still running but it lost the object sounds.
    • Step4: Now close the game and restart it in order to hear proper sounds.
    • Step5: This time start the game again and just leave the screen without any touch.
    • Step6: You will see the sound is gone again just music is playing.
    • Step7: This situation happend randomly sometime if you press two or three times in order to produce this error.

    Observed Result

    I have tested with remote debugging of chrome from my computer and found following errors occours before i lose audio sounds.

    call.preview.js:1021 
    Uncaught (in promise) DOMException: A call to lockOrientation() or unlockOrientation() canceled this 
    
    [/code:2db9u2ea]
    
    [code:2db9u2ea]
    Uncaught (in promise) DOMException: A call to lockOrientation() or unlockOrientation() canceled this call.Runtime.tryLockOrientation  preview.js:1021
    Runtime.initRendererAndLoader  preview.js:739
    Runtime.loadProject  preview.js:1655
    xhr.onload  preview.js:410
    [/code:2db9u2ea]
    
    [img="https://dl.dropboxusercontent.com/u/104183650/error1.png"]    
    
    [b]Expected Result[/b]
    It should not lose its sounds if i would switch the game in middle , music stays fine but it lost the sound clicks and effects.
        
    [b]Affected Browsers[/b]
    [ul]
        [li] Chrome: (YES) [/li][/ul]
        
    [b]Operating System and Service Pack[/b]
    Android OS Lollipop 
    Nexus 5 
    android version 5.1
        
    [b]Construct 2 Version ID[/b]
    Release 216
    
    

    Ashley

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't reproduce this on a Moto X (2014) running Android 5.1 with the latest Chrome browser. I switched several times between the Facebook app and Chrome with preview-over-Wifi. The sound always came back. None of the errors you posted appear relevant to the issue (it just failed to lock the orientation because it's not fullscreen). Am I missing something?

  • I had similar case before when testing my background mode plugin. At that time I used ordinary Cordova export and lost sound after the app is paused for one or two minutes. Then I switched to Crosswalk and the issue is gone.

  • Oh~ try Crosswalk 14

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