问题
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.
回答1:
There is this project too : mfradio.sourceforge.net but not maintened anymore and i did not get it to work on a "late" MIDP device (Sony W995) I'm still using apart form another android device.
Is your development available somewhere ?
Thanks.
来源:https://stackoverflow.com/questions/11084766/mp3-streaming-using-player-switching