I am developing a sample application which can play shoutcast mp3 streams (Developing for S40 platforms, CLDC 1.1, MIDP 2.0). I am using two players switching for continues play back.
I used the below logic for streaming.
Buffer enough chunks
Start Player1
Wait Player1 to finish
Start Player2
Wait Player2 to finish
repeat... 2
The problem is, listener can feel 1 Second silence (Gap) while switching between players.
I would like to know is it possible to stream audio from server without gaps (while switching the players)?
Here is my code for starting player:
Player p = Manager.createPlayer(is, type);
p.addPlayerListener(playerListener);
p.realize();
p.prefetch();
Player2
is prefetched before Player1
finishes - I created a FIFO queue for players, and when a chunk is downloaded, I create input stream -> Player -> Realize() -> Prefetch() -> Push into the Queue.