Exemplo n.º 1
0
        private void PlayAudioTrack(byte[] audBuffer)
        {
            try
            {
                audioTrack = new AudioTrack(
                    Android.Media.Stream.Music,
                    11025,
                    ChannelOut.Mono,
                    Android.Media.Encoding.Pcm16bit,
                    audBuffer.Length,
                    AudioTrackMode.Stream
                    );

                audioTrack.SetNotificationMarkerPosition(audBuffer.Length / 2);
                //audioTrack.SetPlaybackPositionUpdateListener(this);
                audioTrack.Play();

                audioTrack.Write(audBuffer, 0, audBuffer.Length);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("Show something I'm giving up on you!!!");
                MessagingCenter.Send <ISoundRecorder, bool>(this, "ErrorWhileReplaying", true);
            }
        }