Android - Play (mp3) from memory while streaming - java

Sorry about the weird title, I couldn't think of anything better.
In my Android App I want to stream an .mp3 file from an http server, which requires basic authentication. The task is to download the data and save it to the sdcard while playing. (Basicly streaming an mp3 from an http server but also saving the file)
I managed to download the mp3 from the server to the sdcard and to play the downloaded file with the Android MediaPlayer class. But playing only works right when the file is downloaded completely. I want my App to play WHILE downloading.
Can someone point out a good solution to this problem? I thought about using some third-party audio library to stream mp3 audio from memory but I couldn't find anything useful for my problem. Are there any good free librarys for Android that suit my needs?

Related

How can MP3 files without a file extension play in the Android files app and is there any way I can play such files in my MP3 player Android app?

I am creating an MP3 Player app. It's mostly working correctly but there is one edge case.
If a user has a file named "Bieber.mp3" but changes the name of the file to "Bieber" without the file extension in the files app (on Android), they will still be able to play the song properly from the files app depending on the device (older devices like Nexus running on marshmallow will do it while newer devices like the pixel on Android 12 will say it's an invalid file type).
However, when the MP3 file is emailed (or uploaded somewhere in the cloud like drive or Dropbox), the file will have an unknown file type when attempting to from there
I want to know, how can MP3 files that are renamed to exclude the .mp3 extension still play in the android files app? Is there any way I can check to see if a file without the .mp3 extension is still an audio/mp3 file in Java for my mp3 player?
If mp3 files without the mp3 extension can play in the android files app, surely there should be some way to play/access them in the MP3 player I'm making, right?
Well, Android has this library/class called MediaPlayer:
https://developer.android.com/guide/topics/media/mediaplayer
The MediaPlayer is what you use when you play audio,
the MediaPlayer takes the input(the file) as long as it is still encoded as an audio file.
No matter what you do with the file extension, as long as it is still encoded as audio,
it will stay as an audio file.
That's why~

Where to store local video for playback in Android Studio

I am making a simple video playback application in Android Studio. The video is approximately 600MB, and has an appropriate title (no spaces etc.). The video will be played back using VideoView.
Where should the video be saved? When it is placed in src/res/raw, (like other files I am using such as .wav for sound effects), it creates resource errors. Do I create a new folder called assets and store the videos there?
Noooo. You will not put that video in your apk. Will your app exceed 600mb size on playstore. See on google documentation.
Google Play currently requires that your APK file be no more than 100MB
Solution:
First try to compress your video, as you don't need high resolution video.
Put video on cloud (like Amazon s3 bucket).
Download this video file at run time in device from Amazon. And then play it anywhere from device storage.

Android Studio: How to download expansion files and upload to Google play

My app is finished and ready to upload! The problem is it's 432Mb. Google play says my app can't be over 100Mb and I should use an expansion file. I have a general idea of what that is, but feel free to break it down. What I need from you is steps on how to get my expansion files and upload it with my APK to Google play. I'm working with 5 mp3 files at 83MB each.

Audio file duration without AudioSystem class in Java (GAE)?

There is already a more general answer (Java) at https://stackoverflow.com/questions/3009908/how-do-i-get-a-sound-files-total-time-in-java but unfortunately
java.lang.NoClassDefFoundError: javax.sound.sampled.AudioSystem is a restricted class. Please see the Google App Engine developer's guide for more details.
AudioSystem is not on the Google App Engine JRE Class White List and therefore can't be used. Any other approach?
I have (already uploaded) audio files sitting on Google Cloud Storage (GCS) and I can load them into ByteArrayInputStream but somehow I need to convert them into AudioInputStream to get the audio file duration (and save the duration in the database).
A support ticket for Audio Manipulation API along the lines of the Images service is currently in WontFix status: https://code.google.com/p/googleappengine/issues/detail?id=1947, so it is unlikely that there will be support for this in near future. Issue was reopened again: https://code.google.com/p/googleappengine/issues/detail?id=6442
The solution at this point would be to work with external Audio APIs that are available as a Service. Maybe a list from ProgrammableWeb on Audio APIs could help.

Play mp3 file using pjsip

I am working on a project where I need to play audio files over VOIP channel. I am using OpenSource phone (SFLphone). I would like to know how to play an MP3 audio file over VOIP channel.
Application areas: Play audio lecture through VOIP channel.
Maybe you can try to use the Jack Audio Server for this purpose. Though, notice: This site is about programming. maybe this question is a little offtopic. Maybe you should try to make it on some other Stack Exchange site. If it doesn't apply to any other, then let it here.

Categories