Win Phone 8.1 App crashes randomly after adding Audio (CAPX)

0 favourites
From the Asset Store
Check preview, download and add value to your games.
  • CAPX Included!

    Problem Description

    *EDIT:* Same set of sound files were getting triggered at once when player overlaps with a group enemies. Now I used Trigger Once and the crash rate has reduced.

    However after I included BG music and exported to Windows Phone/Emulator, the music stops as soon one or two sound files is played. My CAPX file will show you this happening. I think this is happening with lengthier sound/music files only. (Eg: bgmusic and cricket sounds files are more than 20 seconds in length, and these two files stop playing after few seconds.)

    Continuing my App from my previous post(viewtopic.php?f=152&t=114976) where I resolved the Image Distortion issue by Cropping the large PNG files. The App worked wonderfully without any issue until I added the Audio Object.

    I am playing a single Music file background and various other sound files (like Footsteps, Enemy sounds, Player Hurt, etc). When I exported the game as an Universal App to my Windows Phone Lumia 720, I noticed that the game crashes after about 2 to 3 mins of gameplay. I decided to debug on the Emulator (512MB). I found that it regularly throws up error at this point:

    'WWAHOST.EXE' (Script): Loaded 'Script Code (MSAppHost/2.0)'.

    Exception was thrown at line 14761, column 6 in ms-appx://94047361-e2dc-4b28-9958-c9485e8983ae/c2runtime.js

    0x80004005 - JavaScript runtime error: Unspecified error.

    The program '[1120] WWAHOST.EXE' has exited with code 1 (0x1).

    I went to the c2runtime.js file line #14761. Exactly the code that's supposed to play the Sound file!! If you see there is a Win 8.1 comment from the Developers too.

    if (this.is_music && isMusicWorkaround && !audRuntime.isInUserInputEvent)
    				musicPlayNextTouch.push(this);
    			else
    			{
    				try {
    --------line #14761-------------------->this.instanceObject.play();
    				}
    				catch (e) {}	// sometimes throws on WP8.1... try not to kill the app
    			}[/code:1y7vhwbo][/i]
    
    I started Disabling Audio Play commands until I had only the Foot steps sounds.. Now the rate at which the APP crashed reduced! Infact it seems to run without any issues!
    
    Now my question is., could format of a file by any means cause this issue? All sounds files are in M4A format since I am only developing for Windows Platform. Any help would be greatly appreciated!
    
    [b]Attach a Capx[/b]
    h*t*t*p*s://drive.google.com/file/d/0B3-U8v4LYOJNQXZmaVM2dms0T1U/edit?usp=sharing
        
    [b]Description of Capx[/b]
    A Platformer prototype, where platform is scrolling to the left with random enemies. Press Left/Right key to dodge them. Space to jump.
    I am using multiple BG music files which plays randomly. Enemies have bite and cry sounds played randomly. As time goes, I play a Night sounds with dogs howling. Day time you hear Crows.
    
    [b]Steps to Reproduce Bug[/b]
    [ul]
        [li] Export the Project to VS2013 - Universal app
        [/li][li] Set Windows Phone Project as Start Up
        [/li][li]  Run on 512 MB, Emulator or Windows Phone (mine is Lumia 720) 
        [/li][li]  Press Start Button when loaded
        [/li][li]  Game starts BG music, you can see the Player Sprite and platform moving
        [/li][li]  As soon as player collides with enemy and it makes sounds, the [b]BG music stops.[/b]
        [/li][li]  Continuing to play, the game crashes or report the above mentioned JS error.[/li][/ul]
        
    [b]Observed Result[/b]
    
        
    [b]Expected Result[/b]
    
        
    [b]Affected Browsers[/b]
    [ul]
        [li] Chrome: (NO)
        [/li][li] FireFox: (NO)
        [/li][li] Internet Explorer: (NO)[/li][/ul]
        
    [b]Operating System and Service Pack[/b]
    Windows Phone 8.1 latest updates
    512MB RAM (both Emulator and Phone)
        
    [b]Construct 2 Version ID[/b]
    r178 64Bit
  • Dear Ashley

    Could your or team please help me with this issue? I have attached a CAPX for your reference too.

  • I noticed that same set of sound files were getting triggered at once when player overlaps with a group enemies. Now I used Trigger Once and the crash rate has reduced drastically.

    However after I included BG music and exported to Windows Phone/Emulator, the music stops as soon one or two other sound files is played. My CAPX file will show you this happening.

    I think this is happening with lengthier sound/music files only. (Eg: bgmusic and cricket sounds files are more than 20 seconds in length, and these two files stop playing after few seconds.)

  • So I've noticed this with Space Blaster, and I'm afraid it's a crash in IE or the Windows Phone OS. There's not much we can do about it. The very line you point out is to play some audio, and it's already wrapped in a try/catch because I'd noticed in the past it would randomly fail and crash the game, so the try/catch is there to catch any exceptions and try to carry on running the game normally. But that's not enough, eventually the whole app crashes.

    I posted a bug report to Microsoft here: https://connect.microsoft.com/IE/feedbackdetail/view/970180/audio-crashes-windows-phone-html5-games

    All we can do is hope Microsoft fix it quickly.

  • Wow thanks Ashley!

    I think I found a fix to my issue... the solution is to play less sound files

    I mostly use condition isPlaying("tag"), to check if a set of audio file is playing or not. If not, play the sound file. This has brought down the Crash to ZERO!! yes ZERO

    Now the only problem I have is with the Music going silent after few seconds of playing. Mostly after another sound file is played. Do you thik there is a work around? I just read that converting to .WAV format helps. I need to test this after I go back home.

  • It looks like Windows Phone has really buggy audio support. The best fix is to get Microsoft to fix these issues instead of having to work around everything.

    Apparently Web Audio API support is in development for IE and should make a future update to Windows Phone, so hopefully that will resolve all audio issues on Windows Phone if nothing else does.

  • Thanks again ASHLEY.

    If the .WAV file doesnt fix my issue, I will disable Background music for now. Hopefully MS will come up with some kind of update soon. They have extensively marketed about being able to create HTML5 +JS based apps for Windows 8+. So they should put all their efforts on supporting this area.

    Before finishing the thread, could you please point me to some article that talks about adding Ads and IAP to a Win 8.1 universal app? I cant seem to find anything here. Everything is for Windows 8/WP8.

  • SamRock - the built-in IAP plugin should work on Windows Store universal apps (both desktop and mobile). I'm not aware of which ad services actually work in Windows Store apps - if you point me in the direction of one I can look in to supporting it.

  • Hi Ashley For now, I am planning to use the Microsoft Pub Center. I am very new to the world of Ads and my game on Construct 2 will be my very first App on Win8 Platform.

    I have already reached the 100 event limit.. and planning to buy a license sometime this month. Thank you so much for being generous and allowing us to try all option. I have created 70% of my intended game using the Free version! And it already looks great

    Will buy the license to complete rest of the planned features

  • Ashley I hope you too were on the Twitter #GameDevChat conversation with MS Developer/Evangelists.

    (h^t^t^ps://twitter.com/hashtag/GameDevChat?src=hash )

    I brought up the Audio and Ads issues on WP8.1!!

    It good attention.. I hope they will work with IE and WP developers to fix this ASAP!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have the same problem in a Windows Phone game ... I can start to play and after some time it crash... In some devices I can´t play, it just crash at inicialization... could you test in your win phone please?

    http://www.windowsphone.com/en-gb/store ... 8ba14a2457

  • alemar - see the bug report I linked to earlier, Microsoft need to fix it.

  • Ashley yes I saw.They sent me a email asking me to fix the game saying the game can't use touch... Of course this is an automatic test and probably crashed on start. I have a win phone and I can start to play and after some time it crash.I tested in other win device and really it don't start... Everithing works nice in androids... I'll reply the email explaining the problem, and showing that microsoft should fix , and not us.

  • make sure you bug them to fix their "bugs"!

    Unfortunately not everyone is doing that and they are going really slow on fixing this issue!

  • SamRock eheheh yes I'll bug them...

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