示例#1
0
 public override void BeginInterruption(AVAudioPlayer player)
 {
     if (cbBeginInterruption != null)
     {
         cbBeginInterruption(player, EventArgs.Empty);
     }
 }
示例#2
0
 public override void DecoderError(AVAudioPlayer player, NSError error)
 {
     if (cbDecoderError != null)
     {
         cbDecoderError(player, new AVErrorEventArgs(error));
     }
 }
示例#3
0
 public override void FinishedPlaying(AVAudioPlayer player, bool flag)
 {
     if (cbFinishedPlaying != null)
     {
         cbFinishedPlaying(player, new AVStatusEventArgs(flag));
     }
     if (player.Handle == IntPtr.Zero)
     {
         throw new ObjectDisposedException("player", "the player object was Dispose()d during the callback, this has corrupted the state of the program");
     }
 }
        public static AVAudioPlayer FromData(NSData data)
        {
            unsafe {
                var ap = new AVAudioPlayer(data, IntPtr.Zero);
                if (ap.Handle == IntPtr.Zero)
                {
                    return(null);
                }

                return(ap);
            }
        }
        public static AVAudioPlayer FromUrl(NSUrl url)
        {
            unsafe {
                var ap = new AVAudioPlayer(url, IntPtr.Zero);
                if (ap.Handle == IntPtr.Zero)
                {
                    return(null);
                }

                return(ap);
            }
        }
        public static AVAudioPlayer FromData(NSData data, out NSError error)
        {
            unsafe {
                IntPtr errhandle;
                IntPtr ptrtohandle = (IntPtr)(&errhandle);

                var ap = new AVAudioPlayer(data, ptrtohandle);
                if (ap.Handle == IntPtr.Zero)
                {
                    error = (NSError)Runtime.GetNSObject(errhandle);
                    return(null);
                }
                else
                {
                    error = null;
                }
                return(ap);
            }
        }