I am trying to play an mp3 file with the following code.
AVAudioPlayer player = new AVAudioPlayer();
NSUrl mediaFile = NSUrl.FromFilename(monkeySound);
player = AVAudioPlayer.FromUrl(mediaFile);
player.Delegate = new PlayerDelegate();
if(player.PrepareToPlay()){
player.Play();
}
private class PlayerDelegate:AVAudioPlayerDelegate {
public PlayerDelegate(){
}
public override void FinishedPlaying (AVAudioPlayer player, bool flag)
{
//Some Stuff Done Here
}
}
This is the error I get: Stacktrace:
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) at MonoTouch.Foundation.NSObject/MonoTouch_Disposer.Drain (MonoTouch.Foundation.NSObject) [0x0002a] in /Users/plasma/Source/iphone/monotouch/Foundation/NSObject.cs:305 at (wrapper runtime-invoke) .runtime_invoke_void_this__object (object,intptr,intptr,intptr) at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:26 at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:31 at MonkeyShot.Application.Main (string[]) [0x00000] in /Users/fencer04/Projects/MonkeyShot/MonkeyShot/Main.cs:14 at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr)
Native stacktrace:
0 MonkeyShot 0x000d0d25 mono_handle_native_sigsegv + 343
1 MonkeyShot 0x0000f6f4 mono_sigsegv_signal_handler + 322
2 libSystem.B.dylib 0x992a345b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 AVFoundation 0x0047c28d -[AVAudioPlayer privCommonCleanup] + 50
5 AVFoundation 0x0047c339 -[AVAudioPlayer dealloc] + 51
6 ??? 0x0a2af91c 0x0 + 170588444
7 ??? 0x0a2cab1c 0x0 + 170699548
8 ??? 0x077520d6 0x0 + 125116630
9 MonkeyShot 0x0000f4af mono_jit_runtime_invoke + 1332
10 MonkeyShot 0x001ed319 mono_runtime_invoke + 137
11 MonkeyShot 0x0029da57 monotouch_trampoline + 2527
12 Foundation 0x0140d94e __NSThreadPerformPerform + 251
13 CoreFoundation 0x00e9f8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
14 CoreFoundation 0x00dfd88b __CFRunLoopDoSources0 + 571
15 CoreFoundation 0x00dfcd86 __CFRunLoopRun + 470
16 CoreFoundation 0x00dfc840 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00dfc761 CFRunLoopRunInMode + 97
18 GraphicsServices 0x0404b1c4 GSEventRunModal + 217
19 GraphicsServices 0x0404b289 GSEventRun + 115
20 UIKit 0x01cdfc93 UIApplicationMain + 1160
21 ??? 0x09d530a3 0x0 + 164966563
22 ??? 0x09d52e74 0x0 + 164966004
23 ??? 0x09d52474 0x0 + 164963444
24 ??? 0x09d522cc 0x0 + 164963020
25 ??? 0x09d5241e 0x0 + 164963358
26 MonkeyShot 0x0000f4af mono_jit_runtime_invoke + 1332
27 MonkeyShot 0x001ed319 mono_runtime_invoke + 137
28 MonkeyShot 0x001efa00 mono_runtime_exec_main + 669
29 MonkeyShot 0x001eedea mono_runtime_run_main + 843
30 MonkeyShot 0x000a3083 mono_jit_exec + 200
31 MonkeyShot 0x002a1697 main + 3838
32 MonkeyShot 0x00002809 _start + 208
33 MonkeyShot 0x00002738 start + 40
Debug info from gdb:
/tmp/mono-gdb-commands.0GDVJY:1: Error in sourced command file: unable to debug self
=============================================================== Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries