Stream an audio from server to my app - android

I want to stream an audio from the server to Android App. I found some solutions but my scenario is quite different.
I have an audio file which is uploaded to the server, I want to run that audio on a specific time and must be stop after audio complete.
Now let say a user opens his android app to listen an audio after one minute from the start time of that audio than he must listen audio from after one minute of audio running and could not listen that audio from back and forward.
Please guide me the to do it and which technologies should I use?
Would it be better you use Google Firebase or any Realtime server? or simple hosting will be a nice option ?
Thanks

Related

Detecting pause in sound bytes from microphone in Flutter app

I came across this plugin -- https://pub.dev/packages/sound_stream -- on pub.dev while searching for a solution to listen to microphone from a flutter app (targeted for both android and iOS).
I am able to use this plugin to listen to user utterances from the microphone as well as playback audio when needed in my app. The requirements are as follows:
Listen to user utterances from the microphone,
Convert the audio byte stream received from the microphone into a base64 encoded string,
Send the audio string to a service by calling a REST API (POST),
Optionally, if the service responds back with audio (in form of a base64 encoded string), decode the audio output string, and play back the sound bytes.
All of these steps are working fine -- both on Android and iOS. However, in the MVP, I don't know how to detect a pause in user utterances (in the audio stream received from the microphone) and automatically trigger the REST API call. Currently my app requires the user to toggle the microphone button on and off in order to talk and then send their audio to the service. So, the user currently needs to tap on the microphone button (on my app) to activate the RecorderStream of the sound_stream plugin, speak and tap on the microphone button again to turn off the RecorderStream and at this point my app calls the API. It's like those walkie-talkies of the good old days!
I want to avoid this and seamlessly call the API when I detect a pause in the user speech and send the sound bytes received until then to the service. Any idea on how I might be able to achieve this?
Any tips will be highly appreciated.

Android 9 : How to get Audio in Background from Call made by phone in my app

I have heard a lot about blocking the call recording in android 9. I want to understand is it possible to get audio stream in a background service. Every time a user make a Call. If anyone can help me here what are approach to achieve this like giving notification/asking permission to user for this or building a system app or a plugin or a service. For me Audio stream are required to convert it into speech to text.
i got reference from android documentation for incallService,building a calling App and implementing real time text. I have no idea how to connect these three together to get Audio Stream in background service

WebRTC identify remote stream video stop

I have integrate successfully video call using WebRTC in android with this dependency,
implementation 'org.webrtc:google-webrtc:1.0.21217'
In app if video capture is stopped for remote video stream then at receiver side new frames are also stopped. But now I want to identify if remote stream is stopped to display a message to receiver side.
Is it possible with webrtc events? Can anyone guide me with code or any link ?
Thanks in advance :)
So you want to know if the video has been stooped from the android client or from the remote client ? Your question is a bit confusing. If you stop the video on your local device cant you also send a message to the receiver that the video was stooped on the same event you literally stop the video? If you mean you stop remote video and you get black frames instead of video and want to put an image, again can't you just send a message on the socket(I'm assuming you are using socket) when you stop the video?And also how do you stop the video stream ? As I am aware you can do
stream.getVideoTracks.get(0).setEnable(false) . I assume you are refering to this, on android side. If you geve me some details I would gladly help :)

Background Audio for a Call in Progress - Possible?

I am writing a android app which is supposed to play back a audio file when a call is in progress coming from a specific number .. I tried many approaches.. but all went in vein
Separate Thread
Listener on Telephone service
starting a service in parallel
can any one please help me how to proceed regarding this ?
Update :
I am able to play a mp3 file on call recieve and i am able to play it load on speaker.. but how ever loud i play the calling party is not able to listen to it.... is there anyway i can push the speaker stream to call stream
From the api doc here
Note: You can play back the audio data only to the standard output
device. Currently, that is the mobile device speaker or a Bluetooth
headset. You cannot play sound files in the conversation audio during
a call.
So from this and lots of other so answers we can conclude that we can not play an audio during a call process.
But a long time ago from a personal experience with a handset I got a result where the audiotrack was playing while there was a call established and both the voices were heard at the same time. So I think this depends on handsets if it allows it then you can play.
You can try another thing experimentally. play the audio using a different route ( speakerphone or bluetooth).
Another option is to build your custom android build

reference for doing send audio file by offset android

i am making audio live streaming application. what i was doing before, i recoded voice/audio for certain time and i will push the stop button to stop the recording.
then i put action to send the video after clicking the stop button to server through internet. in here i am using socket programming. it works perfectly however i was not live streaming application.
i have heard about doing the code offset to send the audio file to make it live. it will send bytes by bytes of the audio to the server. however, so far i could not find any reliable tutorial/simple source code of how i would like to do it. does anyone knows where i could fine any reference regarding this method?

Categories

Resources