Alternative to MediaPlayer - android

Actually i'm trying to play a sound inside my raw folder in the project,
The issue is that the device for which i'm developing the app doesn't support MediaPlayer and by following this guide in which the user use AudioTrack, the app just freeze every time the sound play.
So which should be the optimal alternative to MediaPlayer? The sounds i'm trying to play in my app are like "alert" sounds

Related

Xamarin Forms allow music from another app on Android while playing Video

I am facing the issue, that my App Blocks Background Music when using a MediaElement for Video usage.
The bottom line is that I want to play a silent video and the user should still be able to listen to spotify and etc. in the background
In iOS the procedure to allow Background Music is pretty straight forward. On Android I cannot manage to get it working.
I already tried different xamarin.forms libraries where i set the video to mute or the volume to zero.
But nothing seemed to work. I tried for example octane, mediamanager and several other videoplayers.
For this reason, I would now like to try to implement it in the native Android code.
But I haven't found anything about it in various forums.
Xamarin Forms Version is 4.8
You could use a service to stream audio to play audio while your application is not visible or under the lock screen.
You could check the blog about this and download the source file from the Github. https://devblogs.microsoft.com/xamarin/background-audio-streaming-with-xamarin-android/
I test with the sample in the thread i done before to play the audio. libVLCsharp.forms can not play Android resource video file while iOS can
When i make the app which play music in the background, the music would play as well.

Playing sound fast as possible

Now like does the question says, I need a way to play a small sound that lasts for like 1 second or less to play really quickly/fast in my Xamarin Android app. I am using .mp3 files and MediaPlayer class, is there any way to get as fast as possible to play a particular sound?

Google Chromecast receiver doesn't play simultaneous audio

I'm developing a Chromecast application (receiver, HTML5 and Javascript) which communicates with an Android app, all is fine, but I have a problem trying to play two "sounds" at a time in the receiver.
It's a kind of game where I need to play a song at the beggining and play some sound effects during it.
Is this possible? And if it is anyone could help me to do it? I have tried it and it works nice in the browser but in the Chromecast only one of the "sound" is played, the song or the effect, never both.
Thank you very much
You cannot have more than one active Media Element in your DOM in chromecast. For what you want to do, however, you can use Web Audio APIs and accomplish the same for short audio files.

Android Continuously play and stop audio files

I am building an Android application and I want to play multiple audio files back to back. I have a lot of audio files so I don't want to load them at once but as they are needed. I also need a way to stop the continuous playback. So as input I have a File[] array of audio files and I need a way to start continuously playing and stop. I saw MediaPlayer as a way to play the audio files but I wasn't sure how to continuously play them and stop on demand.
The Media Playback API Guide contains everything you need to know. You can also check the RandomMusicPlayer included in the Android SDK samples.

Play sound as system sound

Is it possible to play an MP3 file in Android as system sound?
My problem is that I am developing an application that should play different SMS tones when the application receives an SMS from a particular phonenumber.
In the way it is working right now, I'm using a combination of MediPlayer, AssetFileDescriptor and AudioManager to play the MP3 file, and it's working OK except for one big bug: if user has lowered the media volume to 0, the received sms will be missed because the MP3 cannot be heard.
So, it is possible to get a MP3 file to play using the system sound player? Or get the mediaplayer to use the system sound volume settings?
I think that your best shot it to work with the RingtoneManager
You need to add the sound you want to play first into the manager and then you can play it using an intend
Here is an explanation of how it can be done: https://stackoverflow.com/a/1287415/458365
Hope it helps.

Categories

Resources