Closed vext01 closed 8 years ago
Very well noticed, Edd!
As you can see in the code, FPlay uses only Android's native classes for playback. Which is a good thing from the point of view of final code size and portability. Nevertheless, native classes do not have too many options (in fact, most people complain a lot about the lack of options and tweaks around those classes).
One way out would be to replace native classes with custom ones, increasing FPlay's size in several MB, and forcing another complete rewrite of FPlay's core classes in order to adapt them.
An easier, second solution would be placing a "man in the middle" and cheat with Android. When users add URLs, instead of simply passing that URL down to Android, I could keep that URL to myself, create a local server, say at 127.0.0.1:6000, access the user's URL on my own (allowing me to tweak the buffer size) and pass down to Android the address of this local host (127.0.0.1:6000), so that when Android starts consuming data, it will actually be consuming data already stored in the device's memory.
A drawback to this solution is that it would consume a bit more memory, since both FPlay and Android would be caching data locally. On the other hand, we would be able to cache data as we please :)
@carlosrafaelgn Thanks for the work. I'm trying to achieve the similar thing playing file from URL, cache and save to local storage. Don't really know how to implement it, especially handling the network connection while streaming the data. Any pointer will be greatly appreciated.
@laminsk Hi there!
Check out the class HttpStreamReceiver -> https://github.com/carlosrafaelgn/FPlayAndroid/blob/master/src/br/com/carlosrafaelgn/fplay/playback/HttpStreamReceiver.java
This class does two different things:
More recently, I'm adding a new flavor to FPlay: FPlay X (BuildConfig.X). In this case, only the receiver+metadata processor thread is used. The decoding+playback is performed by another classes:
and
Hope it helps!
Regards!
I was listening to a radio station in fplay the other day and it was skipping a lot.I guess the buffer size needs to be bigger, but I can't see anywhere to tweak it. Thoughts?