XamarinAudioManager
XamarinAudioManager copied to clipboard
Cant seem to make it work from xamarin.forms
HI, I have a shared project and its connected to real time service so whenever there is an update I need my app to play a notification sound.
I installed this nuget package and did the initilize() in both android and ios (dont need uwp). And then when i go to my shared project and try to write await Audio.Manager.PlayBackgroundMusic("bgMusic.mp3");
it shows red underline under Audio as if it didnt find that. I also ensured that i used using AudioManager;
.
Now where am i making mistake? Thanks
I have the same problem....please update if you find a solution
AudioManager.Audio.Manager.PlayBackgroundMusic() works for me, no "using" statements.
having the same problem
AudioManager.Audio.Manager.PlayBackgroundMusic("bgMusic.mp3");
gives me the error "the type or namespace name 'Audio' does not exist in the namespace 'AudioManager'"
have Xamarin.Forms version 2.3.3.180 and XamarinAudioManager version 0.8.6
First of all sorry about closing and re-opening the issue. That was a mistake.
Hi brenaud, To be honest i dont think anyone manage this plugin anymore so no one bothers replying. I ended up using dependency service instead of this plugin because I couldnt make it to work.
I shouldnt probably be giving the link here but it might help others.
https://www.codeproject.com/articles/1088094/WebControls/
Try this it worked. I think for iOS you might need to change the code a little bit. I am giving you my snippet here as well.
Device.BeginInvokeOnMainThread(() =>
{
try
{
NSUrl url = NSUrl.FromFilename(fileName.mp3); //put your mp3 in resources folder
var systemSound = new SystemSound(url);
systemSound.PlaySystemSound();
if (vibration == true)
{
SystemSound.Vibrate.PlaySystemSound();
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
});
Hope it helps.
Thanks
Thank you! I'll try it
I ran into the same thing. Looking into the files, I assume you used a shared project. It only works with PCL otherwise the classes are missing.