public void PlayExclusiveNativeSound(NativeSoundData nativeSoundData, float volume = 1.0F)
        {
            StopExclusiveNativeSound();
            Android.Net.Uri uri = Android.Net.Uri.Parse((nativeSoundData.Intern ?
                                                         MediaStore.Audio.Media.InternalContentUri :
                                                         MediaStore.Audio.Media.ExternalContentUri).ToString() + "/" + nativeSoundData.ID);

            if (nativeSoundData.ID == "")
            {
                uri = Android.Net.Uri.Parse(nativeSoundData.Data);
            }


            Ringtone rt = RingtoneManager.GetRingtone(global::Android.App.Application.Context, uri);

            if (rt != null)
            {
                rt.AudioAttributes = new AudioAttributes.Builder()
                                     .SetUsage(AudioUsageKind.Alarm)
                                     .SetContentType(AudioContentType.Music)
                                     .Build();
                rt.Looping = true;
                rt.Volume  = volume;
                rt.Play();
                exclusiveRingtone = rt;
            }
        }
Exemple #2
0
 public SoundData(NativeSoundData sd) : base(sd)
 {
     Active = false;
 }