CCAudioEngine and BackgroundSounds in Mp3

andutraandutra BRMember

Hello, i am starting to learn CocosSharp and Xamarin, i am trying to play some background music in my game, i copy backgroundMusic.mp3 files to both Content/Sounds folder on IOS and Android, and when i run the command CCAudioEngine.SharedEngine.PreloadBackgroundMusic ("Sounds/backgroundMusic") - I try to run this command on AppDelegate.cs (IOS) and GameLayer.cs (Commom) i am getting the same load asset error.
Anybody can help me?


  • VictorChelaruVictorChelaru USMember ✭✭

    I have yet to investigate this myself, but I suspect you need to use the content pipeline to convert the MP3 to an XNB before you load it. Here's info on the content pipeline:

  • andutraandutra BRMember

    Hi, thanks for your suggestiong but i tried to convert mp3 to xnb file, and the error remains the same. I upload a file with the erro i try to run the following codes and all return the same error message:

    I am sending a print with the complete box with the error too.

    Thanks for your help!

  • BenLevy.4265BenLevy.4265 USMember ✭✭

    It seems that there is some sort of error with the Android implementation of this.

    If you generate a iOS project with your mp3 file, it will generate a backgroundMusic.m4a and a backgroundMusic.xnb file. Add both of those to your iOS AND Android project and it will work. I have not spent the time to figure out what one (or both) that you actually need.

    Then play the sound with: (Assuming you put it in iOS: Content/Sounds and Android: Assests/Content/Sounds)


    This works on VS Android Simulator, Android devices, iOS simulator, and iOS devices.

Sign In or Register to comment.