Audio cache for small files android studio - java

I am developing a soundboard application in which I need to get the specified audio file from the server when the user requests it, but I don't want to stream it or download it every time, just the first time so I was thinking of caching it someway.
I made some research and I found the ExoPlayer library from google but I think it's kinda overkill for my purpose and I can't seem to get my head around it as I'm not so experienced in android development.
Is there any library that I can use?
If not, how can I make the process myself?

Save it to the file system the first time. Then you never have to download it again.

Related

Insert voice instructions to android application

I'm developing an application in android studio for the first time (written in Java).
Since it is gonna be an application for children, one feature I want to have, is a character who will guide them on what to do - for example:
Press here to open the box
I want it to be vocal and also textual since not all the kids know how to read yet.
I've searched for a way to insert audio into the application for each instruction I want to have, but I'm not sure it is the "smartest" way to do it.
Also, I'm not sure how to do that automatically without the need to press start/resume/stop for operating the audio file.
Which way would be the correct way to do this? and how exactly can I implement it?
Use text-to-speech engine build inside android.
https://developer.android.com/reference/android/speech/tts/TextToSpeech
https://www.javatpoint.com/android-texttospeech-example

Is it somehow possible to create image files from GWT charts on google app engine?

I'd need to do an app that runs on google app engine that would be able to automatically create some image files from GWT graphics on server that would be later automatically attached in an email that would be automatically sent once a week.
But as far as I've investigated I see no possible way to do it on server, first off, I haven't been able to use ImageCharts on google appengine I had to use ColumnCharts and LineCharts, so that would complicate the process to turn then into images, althoug I think it could be done although it could take a while, although maybe it would be impossible to do it.
Biggest problem I see is that Google App Engine has File I/O absolutely banned, so although there might be a workaround, I guess it's a difficult one, I know about blobstore, but from what I've seen it just allows you to upload already existing files from you own PC, not to create new ones.
Is there something that could be done?

Is it possible to make an Android App that records Audio while taking fotos?

I've read somewhere that it isn't still possible to record Audio while using the Camera function on Android phones. But this source was kind of outdated.
I've also read, that this is possible on Iphone.
But I need this function for Android to create an App.
Can anybody say more to that?
Is there a possibility on Android to archive that in an Application?
I don't see why not. They don't share the same hardware. Even if not, you could easily fake it by recording video (which also records sound) and just taking the first still image of the video as your photo.

Google Drives SDK and powerpoint

I am currently developing a small android app using the google drive SDK/google doc's embedded player which will play through power point files in a slide-show manner. Since there's no direct way I can tell when one powerpoint ends and another begins using the SDK, I was wondering if there was any way for me to retrieve the number of slides from a power point. With the amount of slides I'll be attempting to use the interval between slide changes to calculate the time taken for each powerpoint to play and then using that I can switch through files. I know .pptx files carry the amount of slides in it's metadata (not so sure about .ppt), but I'm not sure how to go on reading it. I've looked at google drive SDK's part to read metadata, but it seems rather limited to what you can actually read. I've looked at ApachePOI but it doesn't seem it's android compatible. Could anyone point me in the right direction with this?
Thanks :).
Sorry, this is not possible using the Google Drive SDK. You could easily download the pptx, unzip it (it is just zipped XML) and extract the required metadata.

Android MediaPlayer takes long time to prepare and buffer

My application takes a long time to prepare and buffer an audio stream. I have read this question Why does it take so long for Android's MediaPlayer to prepare some live streams for playback?, however it just says people have experienced this issue, it does not state how to improve the problem.
I am experiencing this in all versions of Android, tested from 2.2 - 4.1.2.
The streams are in a suitable bit-rate for mobile and 3G connection. The same stream takes less than a second to start buffering in the equivalent iOS app.
Is there a way to specify the amount of time that should be buffered? I know that the Tune In radio application offers this feature ( https://play.google.com/store/apps/details?id=tunein.player ).
Thanks.
Edit: I've tested again and found that it only happens on devices running Gingerbread and above (>=2.3). I know that Android changed the underlying framework from OpenCore to StageFright. So how can I optimise the media framework? It just seems wrong that the old HTC Wildfire can prepare, stream and play, literally 10x faster than the brand new HTC One X and Nexus 7.
I have struggled with this question for months. Finally i found the solution.
The real problem is in the implementation of the MediaPlayer class. Particularly with the way MediaPlayer buffers the data. This is why the solution is to create your own buffering, save it to a temp file and feed that to MediaPlayer.
This tutorial and source code explain exactly how. http://androidstreamingtut.blogspot.nl/2012/08/custom-progressive-audio-streaming-with.html
By adapting this code, it is easy to create a much better streaming player.
Google Developers really screwed up here.
EDIT : This answer is rather old. Nowdays i would recommend not using MediaPlayer and use ExoPlayer instead. It is extendable, stable and can play many different types of media. You can find it here: https://github.com/google/ExoPlayer/
There really isn't much you can do since the Android MediaPlayer class doesn't provide access to lower level settings such as buffer size. The only alternative would be to make your own player using AudioTrack and a library like FFmpeg to do the decoding.
The one thing I'd recommend is to play around with encoding. For instance, for MP4s, ensure that the MOOV Atom is located at the beginning of the file (there are enough questions on S/O regarding how to do this with ffmpeg, etc). With MP3s, you can look at different codecs or bitrates for instance.
You can, for instance, try a number of audio files you find online, and if you see one that doesn't take a long time to buffer, try to encode your files in the same way.

Categories