Can anyone help me take a look on my code and tell what I did wrong? I using the Xam.Plugin.SimpleAudioPlayer to play sound. However when I use GetManifestResourceStream to get the mp3 file it keep return me null. I had put the mp3 file in android Assets file and build action is AndroidAsset.
here the example of my code:
public MainPage()
{
InitializeComponent();
_simpleAudioPlayer = CrossSimpleAudioPlayer.CreateSimpleAudioPlayer();
var beepStream = GetStreamFromFile();
bool isSuccess = _simpleAudioPlayer.Load(beepStream);
}
private void Button_OnClicked(object sender, EventArgs e)
{
_simpleAudioPlayer.Play();
}
Stream GetStreamFromFile(string filename)
{
var assembly = typeof(MainPage).GetTypeInfo().Assembly;
var stream = assembly.GetManifestResourceStream("beepSound.Android.test.mp3");
return stream;
}